Send 2 Array with json_encode with While PHP command

Asked

Viewed 36 times

-1

I don’t know how else to explain it but come on.

I have a game with . js fighting system the current idea is to add CD (Reload Time) in Skills. Skill em Recarga

When I use another Skill the previous one comes out of CD and puts the new one on CD. Nova Skill em recarga

If the CD is 1 it works because the . JS takes one Skill on CD at a time, BUT here comes the question and if you have two on CD? As the CD is 1 ends up working but when I increase it... Skill CD em 10 The Skill on 1 CD Exits the CD and 10 Enters, but when I click on another that has 1 CD to use it, the Skill on 10 should go to 9 8 7 until finally exit the CD, but what happens is the following: Duas em CD The new one goes on CD but the old one doesn’t change on the console.log Log Here she sent to Skill "Soco" to leave the CD, ie she sends only 1 time this "t_desblock_o".

php file. arquivo.php Here the idea is simple, it orders in ID to take the CD of the last Skill placed and work in 1 in 1, because if it is not so it lets all other Skills work normal while the 10 does not reach 0. battle js. batalha.js This is the JS code that takes the value and then makes the change in jQuery

1 answer

0


I could not send two repeated values but was able to send new values and receive them within . js as follows

inserir a descrição da imagem aqui

with $n = $n+1 it generates several array sending them to the . js the gambiarra was done inside... as it could not do the Array inside the . js climb with While I did several if inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.