Hello geniuses,
Am almost in the process of completing my first animation game but seem to hit a road block.
The game contains several player characters and I would like for the main player character to change to other characters upon hitting a special powerUp; but that never happens.
In the player module; in the collision function, there is a global variable “playerNum” which I assume should change the player character as well as the animation sequence.
-=====player module============================
–player collision listener function
playerCollision = function(self, event)
if( event.target and event.other.myType == “stone” )then
if ( event.phase == “began” ) then
event.other.isVisible = false
event.other.alive = false
playerNum = math.random(4)
print(“printing playerNum”, playerNum)
– self:setSequence( PLAYER_RUN )
– self:play()
return true
end
end
end
============================================
Here is the global variable that should change the characters which also should update the animation sequence:
–========global module=============================================
character = {}
character[1] = “First”
character[2] = “Second”
character[3] = “Third”
character[4] = “Four”
runSequence = “run1”
jumpSequence = “jump”
dieSequence = “dead1”
shootSequence = “shoot1”
playerNum = 4
–PLAYER IMAGES
PLAYER_RUN = character[playerNum] … runSequence
PLAYER_JUMP = character[playerNum] … jumpSequence
PLAYER_DIE = character[playerNum] … dieSequence
PLAYER_SHOOT = character[playerNum] … shootSequence
=======================================================================
I dont know which other method to effect this change during a collision.
PLEASE HELP.
Many thanks.
uche.