[sbfury] 2 new revisions pushed by hugoruscitti on 2010-01-02 19:35 GMT

1 view
Skip to first unread message

codesite...@google.com

unread,
Jan 2, 2010, 2:36:13 PM1/2/10
to losersjue...@googlegroups.com
2 new revisions:

Revision: 9987d98b46
Author: hugoruscitti
Date: Sat Jan 2 10:34:50 2010
Log: cargando todas las imagenes del shaolin para iniciar las animaciones.
http://code.google.com/p/sbfury/source/detail?r=9987d98b46

Revision: 33ec8fdeae
Author: hugoruscitti
Date: Sat Jan 2 11:34:49 2010
Log: adaptando el codigo de estados para manejar el shaolin.
http://code.google.com/p/sbfury/source/detail?r=33ec8fdeae

==============================================================================
Revision: 9987d98b46
Author: hugoruscitti
Date: Sat Jan 2 10:34:50 2010
Log: cargando todas las imagenes del shaolin para iniciar las animaciones.
http://code.google.com/p/sbfury/source/detail?r=9987d98b46

Added:
/data/shaolin/attackjumprun.png
/data/shaolin/attackjumpstand.png
/data/shaolin/attackjumpwalk.png
/data/shaolin/jumpstand.png
/data/shaolin/jumpwalk.png
Modified:
/sbfury/control.py
/sbfury/shaolin.py

=======================================
--- /dev/null
+++ /data/shaolin/attackjumprun.png Sat Jan 2 10:34:50 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /data/shaolin/attackjumpstand.png Sat Jan 2 10:34:50 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /data/shaolin/attackjumpwalk.png Sat Jan 2 10:34:50 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /data/shaolin/jumpstand.png Sat Jan 2 10:34:50 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /data/shaolin/jumpwalk.png Sat Jan 2 10:34:50 2010
Binary file, no diff available.
=======================================
--- /sbfury/control.py Fri Jan 1 19:26:04 2010
+++ /sbfury/control.py Sat Jan 2 10:34:50 2010
@@ -13,6 +13,8 @@
'right': sf.Key.Right,
'up': sf.Key.Up,
'down': sf.Key.Down,
+ 'attack': sf.Key.D,
+ 'jump': sf.Key.A,
}

def update(self, dt):
=======================================
--- /sbfury/shaolin.py Fri Jan 1 21:44:34 2010
+++ /sbfury/shaolin.py Sat Jan 2 10:34:50 2010
@@ -15,12 +15,45 @@
self.control = control

def _load_animations(self):
-
- image = common.load_sheet("../data/shaolin/stand.png", 4, 1)
-
- self.animations = {
- 'stand': animation.Animation(image, 0.20, [0, 1, 2, 3]),
- }
+ animation_defines = [
+ # (name, frames, delay per frame)
+ ('stand', 4, 1),
+ ('attack1', 2, 0.05),
+ ('attack2', 2, 0.05),
+ ('attack3', 2, 0.05),
+ ('attack4', 2, 0.1),
+ ('attackjumprun', 2, 1),
+ ('attackjumpstand', 2, 1),
+ ('attackjumpwalk', 2, 1),
+ ('attackrun', 1, 1),
+ ('attacktake', 1, 1),
+ ('ground', 1, 1),
+ ('groundtostand', 1, 1),
+ ('hardhit', 2, 1),
+ ('hitstand1', 2, 1),
+ ('hitstand2', 2, 1),
+ ('jumpstand', 3, 1),
+ ('jumpwalk', 3, 1),
+ ('run', 4, 0.03),
+ ('special', 5, 1),
+ ('stand', 4, 1),
+ ('starting', 3, 1),
+ ('take', 1, 1),
+ ('throw', 3, 1),
+ ('walk', 4, 1),
+ ]
+
+ # each elements has an animation like: 'stand':
AnimationObject()...
+ self.animations = {}
+
+ for (name, frames, delay) in animation_defines:
+ filename = "shaolin/%s.png" %(name)
+ sheet = common.load_sheet(filename, frames, 1)
+ self.animations[name] = animation.Animation(sheet, delay,
range(frames))
+
+ #self.animations = {
+ # 'stand': animation.Animation(image, 0.20, [0, 1, 2, 3]),
+ # }

def set_animation(self, animation_name):
self.animation = self.animations[animation_name]

==============================================================================
Revision: 33ec8fdeae
Author: hugoruscitti
Date: Sat Jan 2 11:34:49 2010
Log: adaptando el codigo de estados para manejar el shaolin.
http://code.google.com/p/sbfury/source/detail?r=33ec8fdeae

Modified:
/sbfury/control.py
/sbfury/shaolin.py

=======================================
--- /sbfury/control.py Sat Jan 2 10:34:50 2010
+++ /sbfury/control.py Sat Jan 2 11:34:49 2010
@@ -15,6 +15,8 @@
'down': sf.Key.Down,
'attack': sf.Key.D,
'jump': sf.Key.A,
+ 'run': sf.Key.S,
+ 'special': sf.Key.Space,
}

def update(self, dt):
=======================================
--- /sbfury/shaolin.py Sat Jan 2 10:34:50 2010
+++ /sbfury/shaolin.py Sat Jan 2 11:34:49 2010
@@ -1,18 +1,25 @@
from PySFML import sf
import common
import animation
+import states

class Shaolin(sf.Sprite):

def __init__(self, control):
+ self.control = control
+
image = common.load_sheet("../data/shaolin/stand.png", 4, 1)
+ self.image = image
sf.Sprite.__init__(self, image.image)
image.Assign(self)
- self.image = image
+
self.SetPosition(200, 400)
self._load_animations()
self.set_animation('stand')
- self.control = control
+
+ self.change_state(states.Starting(self))
+ self.last_attack = (0, 0)
+ self.dy = 0

def _load_animations(self):
animation_defines = [
@@ -40,7 +47,7 @@
('starting', 3, 1),
('take', 1, 1),
('throw', 3, 1),
- ('walk', 4, 1),
+ ('walk', 4, 0.2),
]

# each elements has an animation like: 'stand':
AnimationObject()...
@@ -61,6 +68,8 @@
self.SetCenter(x, y)

def update(self, dt):
+ self.state.update(dt)
+ '''
self.update_animation(dt)

if self.control.left:
@@ -74,9 +83,22 @@
self.Move(0, -dt * 200)
elif self.control.down:
self.Move(0, dt * 200)
+ '''


def update_animation(self, dt):
was_restarted = self.animation.update(dt)
self.animation.Assign(self)
return was_restarted
+
+ def change_state(self, new_state):
+ self.state = new_state
+
+ def set_flip(self, flip):
+ self.FlipX(flip)
+
+ def move(self, dx, dy):
+ self.Move(dx, dy)
+
+ def are_in_flood(self):
+ return self.dy > 0

Reply all
Reply to author
Forward
0 new messages