5. ボールが 跳 ね返 る プログラム
require 'dxruby'
img1 = Image.new(30, 30, C_BLACK)
img1.circle_fill(15, 15, 15, C_WHITE)
x=0;
#ここまでは
dx=1
#
y=(Window.height-img1.height)/2
#
Window.loop do
#xを dxだけ
x+=dx
#xが ウィンドウの
if(x>Window.width-30) then
#
dx=dx*(-1)
end
Window.draw(x, y, img1)
end