Help pls…
I have (sprite) sequenceData named move “left, right, jump and attack” on each button
how to filter collision when I’m press attack button, player not got damaged and HP bar not -1
here my code
[lua]
life =3
function kurangdarah(event )
if life==3 then
coba.isVisibile= true
life = life-1
nyawa3:removeSelf()
elseif life==2 then
coba.isVisibile= true
life = life-1
nyawa2:removeSelf()
elseif life==1 then
coba.isVisibile= true
life = life -1
nyawa1:removeSelf()
else
end
end
end
------- here the collusion make me crazy---------------------------------
function cobaCollision( self, event )
if event.phase == “began” then
if event.target.type == “coba” and event.other.type ==“tentara” then
kurangdarah()
transition.to(tentara, {time=1000,alpha=0,onComplete=listener})
score= score+1
elseif event.target.type == “coba” and event.other.type ==“tentara2” then
kurangdarah()
transition.to(tentara2, {time=1000,alpha=0,onComplete=listener2})
elseif event.target.type == “coba” and event.other.type ==“tentara3” then
kurangdarah()
transition.to(tentara3, {time=1000,alpha=0,onComplete=listener3})
print (“aw”)
else
print (“hmm”)
end
end
end
coba.collision=cobaCollision
coba.type = “coba”
coba:addEventListener(“collision”,coba)
tentara.type=“tentara”
tentara2.type=“tentara2”
tentara3.type=“tentara3”
grass.type=“grass”
[/lua]
how to make life not -1 if I’m press attack button, when collusion??
help me pls