how to rotate object like super puzzle fighter while the object is moving down
[lua]
object.rotation = object.rotation + 90
[/lua]
or if you dont want to have crazy high rotation numbers in case someone is hitting the rotate button plenty of times:
[lua]
if(object.rotation < 270)then
object.rotation = object.rotation + 90
else
object.rotation = 0
end
[/lua]
the moving down part could either be solved by physics, or by a timed loop that constantly adds a value to your objects y coordinate.
and by timed loop i mean a timer:
http://docs.coronalabs.com/api/library/timer/performWithDelay.html
or enterframe event:
http://docs.coronalabs.com/api/event/enterFrame/index.html
i hope that was some help to get started,
cheers,
michael
Thanks Michael
if I have two objects , object1 and object2 how can I rotate the object2 around the object1
that’s a bit more complicated. but Jérôme Z. got some ways described here:
http://forums.coronalabs.com/topic/33905-how-do-i-rotate-an-object-around-a-specific-axis/
[lua]
object.rotation = object.rotation + 90
[/lua]
or if you dont want to have crazy high rotation numbers in case someone is hitting the rotate button plenty of times:
[lua]
if(object.rotation < 270)then
object.rotation = object.rotation + 90
else
object.rotation = 0
end
[/lua]
the moving down part could either be solved by physics, or by a timed loop that constantly adds a value to your objects y coordinate.
and by timed loop i mean a timer:
http://docs.coronalabs.com/api/library/timer/performWithDelay.html
or enterframe event:
http://docs.coronalabs.com/api/event/enterFrame/index.html
i hope that was some help to get started,
cheers,
michael
Thanks Michael
if I have two objects , object1 and object2 how can I rotate the object2 around the object1
that’s a bit more complicated. but Jérôme Z. got some ways described here:
http://forums.coronalabs.com/topic/33905-how-do-i-rotate-an-object-around-a-specific-axis/