Hello,
I am trying to have an object orbit around a point, just like our planet orbits around our sun. I think i have the logic close, but i am unsure where exactly i am going wrong. Please help. Code below.
local ballOne = display.newImage(“images/1.png”)
ballOne.x = display.contentWidth/2
ballOne.y = display.contentHeight/2 + 60
local degrees = 0
local function animate(event)
local degrees = degrees + 1
local rads = degrees * (Math.PI / 180);
ballOne.x = ballOne.x + 57 * Math.cos(rad);
ballOne.y = ballOne.y + 57 * Math.sin(rad);
end
Runtime:addEventListener(“enterFrame”, animate)
[import]uid: 9521 topic_id: 2321 reply_id: 302321[/import]