-
-
Save Mouq/a12b912ecbd7999bd5c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ThroughTheWindow b/ThroughTheWindow | |
index 8161553..7180fc3 100755 | |
--- a/ThroughTheWindow | |
+++ b/ThroughTheWindow | |
@@ -64,15 +64,22 @@ class Game is Steroids::Game { | |
$!last-cloud = $!distance; | |
} | |
- if self.is_pressed("Space") and $!runner.y == GROUNDLEVEL - $!runner.h { | |
- $!runner.velocity[1] = -22; | |
- unless $!jumped { | |
- $!jumped = True; | |
- my $b = self.add_sprite('banner2', self.width, GROUNDLEVEL); | |
- $b.y += $b.h; | |
- $b.velocity[0] = -5; | |
+ state $in-jump = False; | |
+ if self.is_pressed("Space") { | |
+ if $!runner.y == GROUNDLEVEL - $!runner.h or $in-jump { | |
+ $in-jump = True; | |
+ $!runner.velocity[1] = -22; | |
+ unless $!jumped { | |
+ $!jumped = True; | |
+ my $b = self.add_sprite('banner2', self.width, GROUNDLEVEL); | |
+ $b.y += $b.h; | |
+ $b.velocity[0] = -5; | |
+ } | |
} | |
+ } else { | |
+ $in-jump = False; | |
} | |
+ | |
$!distance++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment