Merge branch 'master' of hongabar.org:robotgame

This commit is contained in:
Lasse 2012-08-08 15:07:06 +02:00
commit 42610349b7
3 changed files with 4 additions and 4 deletions

View File

@ -51,6 +51,6 @@ class Block(worldobject.WorldObject):
def draw(self, window): def draw(self, window):
window.blit(self.img, (self.x - 32 - self.level.camera_x, window.blit(self.img, (self.x - 32 - self.level.camera_x,
self.y - self.img.get_size()[1] self.y - self.img.get_size()[1] + 24
- self.level.camera_y)) - self.level.camera_y))

View File

@ -106,7 +106,7 @@ class Game(object):
""" """
Draw all game objects. Draw all game objects.
""" """
self.window.fill((0, 255, 255)) self.window.fill((0, 0, 0))
for obj in self.objs: for obj in self.objs:
if hasattr(obj, 'draw'): if hasattr(obj, 'draw'):
obj.draw(self.window) obj.draw(self.window)

View File

@ -82,8 +82,6 @@ class Player(worldobject.WorldObject):
obj.use(self) obj.use(self)
def update(self, e, t, dt): def update(self, e, t, dt):
worldobject.WorldObject.update(self, e, t, dt)
for event in e: for event in e:
if event.type == pygame.KEYDOWN: if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP: if event.key == pygame.K_UP:
@ -114,6 +112,8 @@ class Player(worldobject.WorldObject):
self.frame = ((self.frame + self.anim_speed * dt) % self.frame = ((self.frame + self.anim_speed * dt) %
len(self.imgs[self.anim])) len(self.imgs[self.anim]))
worldobject.WorldObject.update(self, e, t, dt)
def draw(self, window): def draw(self, window):
self.img = self.imgs[self.anim][int(self.frame)] self.img = self.imgs[self.anim][int(self.frame)]
self.img.set_alpha(128) self.img.set_alpha(128)