Created
July 2, 2013 18:43
-
-
Save code-later/5911929 to your computer and use it in GitHub Desktop.
Shoes Pony Example for SIGINT
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
Shoes.app width: 600, height: 600 do | |
@knopf = button("Start", left: 300, top: 300) do | |
@pinky = image "/Users/dbreuer/Desktop/pinkie.png", width: 120, left: 0 | |
@dash = image "/Users/dbreuer/Desktop/dash.png", width: 120, left: 400 | |
@knopf.hide | |
end | |
#@mein_kreis = oval(0, 100, 25, fill: red, stroke: pink) | |
#animate 60 do | |
# @pony.left = mouse[1] - @pony.width/2 | |
# @pony.top = mouse[2] - @pony.height/2 | |
#end | |
keypress do |k| | |
case k | |
when "h" | |
@pinky.left -= 5 | |
when "l" | |
@pinky.left += 5 | |
when "k" | |
@pinky.top -= 5 | |
when "j" | |
@pinky.top += 5 | |
when "a" | |
@dash.left -= 5 | |
when "d" | |
@dash.left += 5 | |
when "w" | |
@dash.top -= 5 | |
when "s" | |
@dash.top += 5 | |
end | |
if @dash && (@pinky.left..(@pinky.left+60)) === @dash.left | |
alert "BANG!!" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment