[sbfury] push by hugoruscitti - colocando un punto de control al personaje. on 2010-01-02 05:44 GMT

1 view
Skip to first unread message

codesite...@google.com

unread,
Jan 2, 2010, 12:45:15 AM1/2/10
to losersjue...@googlegroups.com
Revision: 2eed168592
Author: hugoruscitti
Date: Fri Jan 1 21:44:34 2010
Log: colocando un punto de control al personaje.
http://code.google.com/p/sbfury/source/detail?r=2eed168592

Modified:
/sbfury/animation.py
/sbfury/shaolin.py
/sbfury/sheet.py

=======================================
--- /sbfury/animation.py Fri Jan 1 14:00:53 2010
+++ /sbfury/animation.py Fri Jan 1 21:44:34 2010
@@ -42,3 +42,6 @@
self.sheet.SetFrameIndex(frame_to_show)

return was_restarted
+
+ def get_center(self):
+ return self.sheet.get_center()
=======================================
--- /sbfury/shaolin.py Fri Jan 1 19:26:04 2010
+++ /sbfury/shaolin.py Fri Jan 1 21:44:34 2010
@@ -9,7 +9,7 @@
sf.Sprite.__init__(self, image.image)
image.Assign(self)
self.image = image
- self.SetPosition(200, 200)
+ self.SetPosition(200, 400)
self._load_animations()
self.set_animation('stand')
self.control = control
@@ -24,14 +24,18 @@

def set_animation(self, animation_name):
self.animation = self.animations[animation_name]
+ x, y = self.animation.get_center()
+ self.SetCenter(x, y)

def update(self, dt):
self.update_animation(dt)

if self.control.left:
self.Move(-dt * 200, 0)
+ self.FlipX(True)
elif self.control.right:
self.Move(dt * 200, 0)
+ self.FlipX(False)

if self.control.up:
self.Move(0, -dt * 200)
=======================================
--- /sbfury/sheet.py Fri Jan 1 13:33:57 2010
+++ /sbfury/sheet.py Fri Jan 1 21:44:34 2010
@@ -15,6 +15,9 @@
self.sub_rect = sf.IntRect(0, 0, self.frame_width,
self.frame_height)
self.SetFrameIndex(0)

+ def get_center(self):
+ return self.frame_width / 2, self.frame_height - 10
+
def SetFrameIndex(self, index):
self.index = index

Reply all
Reply to author
Forward
0 new messages