Rotating back to original location on completion

Hello Everyone, I have one hand sitting over another hand. They are two different objects. I want the top hand to rotate when it throws an object. Then upon completion of throwing the object I want the hand to rotate to its original position. Any help would be great and this is what I currently have…

[code]

local function shootStar( event )

star = display.newImage(“images/Lvl_4/shuriken.png”)
star.name = “star”
star:setReferencePoint(display.TopCenterReferencePoint)
star.x = display.contentWidth * 0.5
star.y = display.contentHeight
physics.addBody(star, “dynamic”, {density=1.0, friction=0.5, bounce=0.0, radius= 10})
star.isBullet = true
star.isSensor = false
lh:rotate(-45)
transition.to( star, { time=1500, y = 0 , onComplete = rotateHand()} )
–star.collision = onCollision;
–star:addEventListener(“collision”, star);

end

function rotateHand(event)

lh:rotate(45)
return lh
end [import]uid: 49863 topic_id: 23065 reply_id: 323065[/import]

Hope this gives you some insight.

[code]
local function batter()
local rec1 = display.newRect(200,200, 10, 100)
rec1:setReferencePoint(display.BottomCenterReferencePoint)
rec1.rotation = 90
local move_timer = nil
local trans = nil

local function move_one()
print(“move_one”)

local function move_two()
print(“move_two”)

trans = transition.to(rec1, {time=4000, rotation = 90, onComplete=move_one})
end

trans = transition.to(rec1, {time=100, rotation=0, onComplete=move_two})
end
move_one()
end

batter()
[/code] [import]uid: 21331 topic_id: 23065 reply_id: 92241[/import]

Hello TheRealTonyK, Makes sense I forgot to mention that this is all firing on a touch event. Once the player touches the screen the shootStar function is called. Here is the code with the part I forgot to include. Do you still think your method will work?

[code]

local function shootStar( event )

star = display.newImage(“images/Lvl_4/shuriken.png”)
star.name = “star”
star:setReferencePoint(display.TopCenterReferencePoint)
star.x = display.contentWidth * 0.5
star.y = display.contentHeight
physics.addBody(star, “dynamic”, {density=1.0, friction=0.5, bounce=0.0, radius= 10})
star.isBullet = true
star.isSensor = false
lh:rotate(-45)
transition.to( star, { time=1500, y = 0 , onComplete = rotateHand} )
–star.collision = onCollision;
–star:addEventListener(“collision”, star);

end

function rotateHand(event)

lh:rotate(45)
return lh
end

background:addEventListener(“tap”, shootStar) [import]uid: 49863 topic_id: 23065 reply_id: 92246[/import]

sure, I was leaving the exact implementation up to you. here it is for ya:

local rec1 = display.newRect(200,200, 10, 100)  
rec1:setReferencePoint(display.BottomCenterReferencePoint)  
rec1.rotation = 90  
local move\_timer = nil  
local trans = nil  
  
local function batter(event)   
 print("here")  
  
 local function move\_one()  
 print("move\_one")  
  
 local function move\_two()  
 print("move\_two")  
  
 trans = transition.to(rec1, {time=4000, rotation = 90})  
 end  
  
 trans = transition.to(rec1, {time=100, rotation=0, onComplete=move\_two})  
 end  
 move\_one()  
  
end  
  
--batter()  
Runtime:addEventListener("tap", batter)  

[import]uid: 21331 topic_id: 23065 reply_id: 92249[/import]

Thanks you TheRealTonyK. That worked perfectly. Now if I can just figure out how to get the star to appear in between the hands this game is complete. [import]uid: 49863 topic_id: 23065 reply_id: 92267[/import]