going
This commit is contained in:
parent
ded7b14324
commit
6bb83d5790
|
@ -23,6 +23,7 @@ class Sprite(Animation):
|
|||
self.set_frameset(0)
|
||||
self.locations.append(Location(self))
|
||||
self.motion_overflow = Vector()
|
||||
self.stop()
|
||||
self.display_surface = self.get_display_surface()
|
||||
|
||||
def __getattr__(self, name):
|
||||
|
@ -203,8 +204,19 @@ class Sprite(Animation):
|
|||
for frameset in self.framesets:
|
||||
frameset.reverse()
|
||||
|
||||
def go(self, dx=0, dy=0):
|
||||
self.go_vector = Vector(dx, dy)
|
||||
|
||||
def stop(self):
|
||||
self.go_vector = Vector()
|
||||
|
||||
def is_going(self):
|
||||
return self.go_vector != [0, 0]
|
||||
|
||||
def update(self, areas=None, substitute=None):
|
||||
Animation.update(self)
|
||||
if self.is_going():
|
||||
self.move(*self.go_vector)
|
||||
if self.get_current_frameset().length():
|
||||
self.draw(areas, substitute)
|
||||
|
||||
|
|
Loading…
Reference in New Issue