Player and block now move properly when grabbed.
This commit is contained in:
parent
bd325316d0
commit
12cfda78f1
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue