This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| class Player(pygame.sprite.Sprite): | |
| def __init__(self, img_filename, init_position, speed=5): | |
| self.speed=speed | |
| self.position=init_position | |
| self.image = pygame.image.load(img_filename) | |
| def update(self): | |
| #TODO: physics implementation | |
| pass | |
| def move(self, w, a, s, d): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Wall(Object): | |
| def __init__(self, type1): | |
| self.type=type1 | |
| self.damage=100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| #1 | |
| screen = pygame.display.set_mode((640, 400)) | |
| running = 1 | |
| while running: | |
| #2 | |
| event = pygame.event.poll() | |
| #3 | |
| if event.type == pygame.QUIT: | |
| running = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| from player import Player | |
| screen = pygame.display.set_mode((640, 400)) | |
| running = 1 | |
| player=Player("player.png", (100,100)) | |
| while running: | |
| event = pygame.event.poll() | |
| if event.type == pygame.QUIT: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| from pygame import * | |
| from player import Player | |
| controls=[False, False, False, False] | |
| screen = pygame.display.set_mode((640, 400)) | |
| running = 1 | |
| player=Player("player.png", [100,150]) | |
| while running: | |
| player.update() | |
| events = pygame.event.get() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gravity=0.5 | |
| self.vspeed+=gravity | |
| self.position[1]+=self.vspeed | |
| if self.position[1]>400-64: | |
| self.position[1]=400-64 | |
| self.vspeed=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import struct | |
| print( 8 * struct.calcsize("P")) | |
| import pygame | |
| from pygame import * | |
| from player import Player | |
| controls=[False, False, False, False] | |
| screen = pygame.display.set_mode((640, 400)) | |
| running = 1 | |
| player=Player("player.png", [100,150]) | |
| while running: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| class Player(pygame.sprite.Sprite): | |
| def __init__(self, img_filename, init_position, speed=5): | |
| self.speed=speed | |
| self.vspeed=0 | |
| self.onGround=False | |
| self.position=init_position | |
| self.image = pygame.image.load(img_filename) | |
| def update(self): | |
| gravity=0.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // PDAppDelegate.h | |
| // StatusBar | |
| // | |
| // Created by Julian Meyer on 9/23/12. | |
| // Copyright (c) 2012 Julian Meyer. All rights reserved. | |
| // | |
| #import <Cocoa/Cocoa.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // PDAppDelegate.m | |
| // StatusBar | |
| // | |
| // Created by Julian Meyer on 9/23/12. | |
| // Copyright (c) 2012 Julian Meyer. All rights reserved. | |
| // | |
| #import "PDAppDelegate.h" |
OlderNewer