Is my code correct?
This is code for moving something to a random part of a screen, where you have to click it in a certain amount of time or you lose. Is it correct?
Because after implementing the function under the "draw" function, it showed the sprite to be wildly glitching out!
moveobject = function(spritename)
ranx = random.next()*336-168
rany = random.next()*180-90
ranw = random.nextInt(100)
ranh = random.nextInt(100)
screen.drawSprite(spritename,ranx,rany,ranw,ranh)
after 3 seconds do
if mouse.press then
if mouse.x < ranx+ranw then
if mouse.y < rany+ranh then
print("YAY! you pressed a button")
else
print("You didnt press in time")
end
end
end
end
end