projects
/
python-bulletml.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3ee9895
)
If a ChangeDirection, ChangeSpeed, Accel, or Wait action takes 0 frames, do it immedi...
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Thu, 18 Mar 2010 08:36:08 +0000
(
01:36
-0700)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Thu, 18 Mar 2010 08:36:08 +0000
(
01:36
-0700)
bulletml/impl.py
patch
|
blob
|
history
diff --git
a/bulletml/impl.py
b/bulletml/impl.py
index f3d7e12ca4d9120372f208b6db9c74e74a02e7b7..8508896a83a0412789326e50e86b05c3185fff4b 100644
(file)
--- a/
bulletml/impl.py
+++ b/
bulletml/impl.py
@@
-172,7
+172,12
@@
class Action(object):
elif isinstance(action, parser.ChangeSpeed):
frames, (speed, type) = action(s_params, rank)
self.speed_frames = frames
elif isinstance(action, parser.ChangeSpeed):
frames, (speed, type) = action(s_params, rank)
self.speed_frames = frames
- if type == "sequence":
+ if frames <= 0:
+ if type == "absolute":
+ owner.speed = speed
+ elif type == "relative":
+ owner.speed += speed
+ elif type == "sequence":
self.speed = speed
elif type == "relative":
self.speed = speed / frames
self.speed = speed
elif type == "relative":
self.speed = speed / frames
@@
-188,21
+193,28
@@
class Action(object):
else:
if type == "absolute":
direction -= owner.direction
else:
if type == "absolute":
direction -= owner.direction
- elif type == "relative":
- direction = direction
- else:
+ elif type != "relative": # aim or default
self.aiming = True
direction += owner.aim - owner.direction
self.aiming = True
direction += owner.aim - owner.direction
- self.direction = (
- (direction + math.pi) % PI_2 - math.pi) / frames
+ # Normalize to [-pi, pi).
+ direction = (direction + math.pi) % PI_2 - math.pi
+ if frames <= 0:
+ owner.direction += direction
+ else:
+ self.direction = direction / frames
elif isinstance(action, parser.Accel):
frames, horizontal, vertical = action(s_params, rank)
self.accel_frames = frames
if horizontal:
mx, type = horizontal
elif isinstance(action, parser.Accel):
frames, horizontal, vertical = action(s_params, rank)
self.accel_frames = frames
if horizontal:
mx, type = horizontal
- if type == "sequence":
+ if frames <= 0:
+ if type == "absolute":
+ owner.mx = mx
+ elif type == "relative":
+ owner.mx += mx
+ elif type == "sequence":
self.mx = mx
elif type == "absolute":
self.mx = (mx - owner.mx) / frames
self.mx = mx
elif type == "absolute":
self.mx = (mx - owner.mx) / frames
@@
-210,7
+222,12
@@
class Action(object):
self.mx = mx / frames
if vertical:
my, type = vertical
self.mx = mx / frames
if vertical:
my, type = vertical
- if type == "sequence":
+ if frames <= 0:
+ if type == "absolute":
+ owner.my = my
+ elif type == "relative":
+ owner.my += my
+ elif type == "sequence":
self.my = my
elif type == "absolute":
self.my = (my - owner.my) / frames
self.my = my
elif type == "absolute":
self.my = (my - owner.my) / frames
@@
-228,7
+245,8
@@
class Action(object):
elif isinstance(action, parser.Wait):
self.wait_frames = action(s_params, rank)
elif isinstance(action, parser.Wait):
self.wait_frames = action(s_params, rank)
- break
+ if self.wait_frames:
+ break
elif isinstance(action, parser.Vanish):
owner.vanish()
elif isinstance(action, parser.Vanish):
owner.vanish()