Code: Select all
function load()
angle = 67
x = 100
y = 500
speed = 20
end
function update(dt)
x = x + math.cos(math.rad(angle)) * dt * speed
y = y - math.sin(math.rad(angle)) * dt * speed
end
function draw()
love.graphics.rectangle(love.draw_fill, x, y, 10, 10)
end
Of course, if you fiddle with cos and sin long enough, you get what you need (because cos(x) = sin(x+pi/2), cos(x)=cos(-x), sin(x)=-sin(-x) etc.)