In corona the objects appear on top of each other. I have two hands and a throwing star. I want the star to appear to be under one hand above the other. Does anyone have any idea how to do this?
[code]
local function spawnPlayer ( event )
lh = display.newImage(“images/Lvl_4/left_hand_final.png”)
lh.name = “Left Hand”
lh.x = display.contentWidth * 0.5 - 20
lh.y = display.contentHeight
lh.xScale = 0.5
lh.yScale = 0.5
lh:setReferencePoint(display.TopCenterReferencePoint)
physics.addBody(lh, “kinematic”, {density=1.0, friction=0.5, bounce=0.0, radius= 10})
lh.isSensor = true
lh.collision = onCollision
lh:addEventListener(“collision”, lh)
mg:insert(lh)
end
local function spawnPlayer2 ( event )
rh = display.newImage(“images/Lvl_4/right_hand_open_final.png”)
rh.name = “Right Hand”
rh.x = display.contentWidth * 0.5 + 20
rh.y = display.contentHeight + 30
rh.xScale = 0.5
rh.yScale = 0.5
rh:setReferencePoint(display.TopCenterReferencePoint)
rh:rotate( 60)
physics.addBody(rh, “kinematic”, {density=1.0, friction=0.5, bounce=0.0, radius= 10})
rh.isSensor = true
rh.collision = onCollision
rh:addEventListener(“collision”, rh)
mg:insert(rh)
end
local function shootStar( event )
local move_timer = nil
local trans = nil
star = display.newImage(“images/Lvl_4/shuriken.png”)
star.name = “star”
star:setReferencePoint(display.TopCenterReferencePoint)
star.x = rh.x - 20
star.y = rh.y
physics.addBody(star, “dynamic”, {density=1.0, friction=0.5, bounce=0.0, radius= 10})
star.isBullet = true
star.isSensor = false
transition.to( star, { time=1500, y = 0 })
–star.collision = onCollision;
–star:addEventListener(“collision”, star);
local function move_one()
print(“move_one”)
local function move_two()
print(“move_two”)
trans = transition.to(lh, {time=200, rotation = 0})
end
trans = transition.to(lh, {time=200, rotation=-90, onComplete=move_two})
end
move_one()
end
background:addEventListener(“tap”, shootStar) [import]uid: 49863 topic_id: 23078 reply_id: 323078[/import]