math.randomseed(sys.Datetime().milliseconds)
local ui = require "ui"
local win = ui.Window("-", 1000, 700)
local buton= ui.Button(win,"Move! Hower", 20, 20, 80, 35)
picture= ui.Picture(win, "Resim_Icon/top_32x32.png", 500,350)
horizantal_1= ui.Picture(win, "Resim_Icon/YatayCizgi.png", 100,30)
horizantal_2= ui.Picture(win, "Resim_Icon/YatayCizgi.png", 100,640)
vertical_1= ui.Picture(win, "Resim_Icon/DuseyCizgi.png", 100,40)
vertical_2= ui.Picture(win, "Resim_Icon/DuseyCizgi.png", 940,40)
win:show()
local alpha= math.rad(math.random(360))
local i=1
function control(_x, _y)
if _x <= 110 then
alpha= math.rad(math.random(0,180))
end
if _x >= 910 then
alpha= math.rad(math.random(180,360))
end
if _y <= 40 then
alpha= math.rad(math.random(90,270))
end
if _y >= 610 then
alpha= math.rad(math.random(270,360))
end
end
function buton:onHover()
i=1+1
picture.x = picture.x + i*math.sin(alpha)
picture.y = picture.y - i*math.cos(alpha)
control(picture.x, picture.y)
end
repeat
ui.update()
until not win.visible