Untitled

mail@pastecode.io avatar
unknown
lua
a year ago
462 B
2
Indexable
Never
player = {
	x_start = 300,
	y_start = 300,
	x = 0,
	y = 0,
	x_rad = 120,
	y_rad = 120,
	t = 0
}

love.update = function(dt)
	player.x = player.x_start+player.x_rad*math.sin(player.t+math.pi/2)
	player.y = player.y_start+player.y_rad*math.sin(2*player.t)
	player.t = player.t + dt
	if (player.t >= 2*math.pi) then
	  player.t = player.t - 2*math.pi
	end
end

love.draw = function()
	love.graphics.circle("fill", player.x, player.y, 100)
end