samedi 23 septembre 2017

JavaScript if else problems

everyone! I have been having problems with my code. I think I know what is wrong but I can't seem to fix it, no matter how much I tried so I decided to take it up with the community. I think it is because of the second if statements contradict the one before it. Here, take a look.

        if (Character.style.backgroundImage === "url(../images/animations/moveRightAnimation/1.png)") {

            Character.style.backgroundImage = "url(../images/animations/moveRightAnimation/2.png)";

        } else (Character.style.backgroundImage != "url(../images/animations/moveRightAnimation/1.png)") {

            Character.style.backgroundImage = "url(../images/animations/moveRightAnimation/1.png)";

Hopefully, you see what I am talking about and know what the answer is. As I said in my last post I am not a great coder, so don't judge me too hard, XD.

Aucun commentaire:

Enregistrer un commentaire