Hi,
When I try to rotate my player-tank to match its original starting rotation, it doesn’t work…
As I explain in the video, I think it has to do with the joystick module.
video
(HD when downloaded)
Here is my re-spawn function code:
[lua]
local function playerDestroyed()
local function HidePlayer()
user_tank.x = - 300
user_tank.y = - 300
Ptank.isVisible = false
end
timer.performWithDelay(25, HidePlayer)
LeftStick.isVisible = false
LeftStick.isHitTestable = false
transRect.isHitTestable = false
PTMBtn.isVisible = false
PTMBtn.isHitTestable = false
PTMBtnbgi.isVisible = false
if lives < 3 then
local function respawnPlayer()
local function revealPlayer()
user_tank.x = 219
user_tank.y = 205
user_turret.rotation = 270
transition.to(user_tank, {timer = 3000, rotation = 270})
Ptank.isVisible = true
end
timer.performWithDelay(25, revealPlayer)
LeftStick.isVisible = true
LeftStick.isHitTestable = true
transRect.isHitTestable = true
PTMBtn.isVisible = true
PTMBtn.isHitTestable = true
PTMBtnbgi.isVisible = true
end
timer.performWithDelay(4000, respawnPlayer, 1 )
end
end
local function onPlayerCollision(self, event)
if (event.phase == “began” and event.other.class == “EnemyBullet”) then
print(" Player DEAD ")
lives = lives - 1
Particles.DeleteEmitter(event.other.emitterRef)
display.remove(event.other)
EnemyBulletCount = EnemyBulletCount - 1
ExplosionEmitter2 = Particles.GetEmitter(“ExplosionEmitter2”)
ExplosionEmitter2.x = user_tank.x
ExplosionEmitter2.y = user_tank.y
Particles.StartEmitter(“ExplosionEmitter2”)
timer.performWithDelay(25, playerDestroyed)
end
end
[/lua]
– Crude as it may be, it works. –
And here is a link to the joystick module code: link
Any 'n all comments, opinions or tips are welcome.
-Saer