Created
May 3, 2017 17:13
-
-
Save ongaeshi/2ae67435ad156fc72f41be326e079928 to your computer and use it in GitHub Desktop.
Moving Circle with Mouse
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
# coding: utf-8 | |
a = 1 | |
b = 3 | |
array = [1, 2, 3] | |
# array.each { |e| } | |
r = a + b + array[0] + array[1] + array[2] | |
println "Hello mruby #{r}" | |
println "こんにちは, Siv3DRuby" | |
# wait_key | |
x = -100 | |
y = 480 | |
while System.update do | |
Circle.new(Point.new(x, y), 50).draw | |
Circle.new(Mouse.pos, 30).draw | |
if x > 800 | |
x = -100 | |
y = 480 | |
end | |
x += 1 | |
if x > 320 - 50 | |
y += 1 | |
else | |
y -= 1 | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment