Skip to content

Instantly share code, notes, and snippets.

@Mouq
Created March 23, 2014 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mouq/0eddb558f2dbf3b1b1c0 to your computer and use it in GitHub Desktop.
Save Mouq/0eddb558f2dbf3b1b1c0 to your computer and use it in GitHub Desktop.
diff --git a/ThroughTheWindow b/ThroughTheWindow
index 8161553..e7aeb14 100755
--- a/ThroughTheWindow
+++ b/ThroughTheWindow
@@ -64,7 +64,9 @@ class Game is Steroids::Game {
$!last-cloud = $!distance;
}
- if self.is_pressed("Space") and $!runner.y == GROUNDLEVEL - $!runner.h {
+ state $secs;
+ if self.is_pressed("Space") {
+ $secs = now;
$!runner.velocity[1] = -22;
unless $!jumped {
$!jumped = True;
@@ -72,7 +74,10 @@ class Game is Steroids::Game {
$b.y += $b.h;
$b.velocity[0] = -5;
}
+ } elsif $!runner.y > GROUNDLEVEL - $!runner.h {
+ $!runner.velocity[1] = 2*(now - $secs);
}
+
$!distance++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment