@@ -25,8 +25,10 @@ package
25
25
public function facingRight ():Boolean {return facing == RIGHT ; }
26
26
27
27
public function steadyFall ():void {move (0 ,0.5 ); }
28
+
29
+ public function hasLanded ():Boolean {return ! canMove(0 ,frameHeight/ 2 ); }
28
30
29
- public function jump ():void {move (0 ,- 0.5 ); }
31
+ public function jump ():void {block = null ; move (0 ,- 0.5 ); }
30
32
31
33
public function isCrushed ():Boolean
32
34
{
@@ -67,7 +69,9 @@ package
67
69
68
70
// Is the player holding a block? If so it should move with the player.
69
71
// (Note that moving a block moves all blocks above it)
70
- if (block != null )
72
+ // (If the block grabbed is falling, the player should not be able to move it left or right)
73
+ // (The player can, however, jump from tower to tower)
74
+ if (block != null && (dx == 0 || block. hasLanded() || hasLanded()))
71
75
{
72
76
// Is the player pushing?
73
77
// (Also must check if the block above can move, if it exists
@@ -181,7 +185,8 @@ package
181
185
actionTimer = 0 ;
182
186
183
187
// Jump?
184
- if (! canMove(0 ,frameHeight/ 2 ) && FlxG. keys. justPressed("SPACE" ))
188
+ // (Able to jump if the player cannot fall or is clinding to a block, like wall jumping)
189
+ if ((! canMove(0 ,frameHeight/ 2 ) || block != null ) && FlxG. keys. justPressed("SPACE" ))
185
190
{
186
191
// Yes, jump
187
192
// (The Jump height tracks motion in the total dy of the jump)
0 commit comments