Rotate

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Rotate

Post by Ref »

Simple. With orbit center (cx,cy), orbit radii (rx,ry) and angle, calculate the new location of the object.

Code: Select all

function orbit( cx, cy, rx, ry, an )
	local x = rx * math.cos( an ) + cx
	local y = ry * math.sin( an ) + cy
	return x, y
end
Attachments
pushless.love
Once again an example
(257.33 KiB) Downloaded 78 times
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Rotate

Post by Ref »

If you want to use push and pop, this might help you????
Attachments
pushpop.love
(678 Bytes) Downloaded 67 times
Miawwe
Prole
Posts: 3
Joined: Mon Apr 10, 2017 6:52 pm

Re: Rotate

Post by Miawwe »

Could you please make me example with 2 planets that rotate on different speeds please? xd I really still don't know how you use that push and pop.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Rotate

Post by Ref »

As per your request.
Best
Attachments
PushAndPop.love
Two planet demo
(498 Bytes) Downloaded 70 times
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 206 guests