I got this code that works perfectly fine, just like i want it to, but then i want to extend it with else if, but the way i have done my code, that's not possible. Feel free to link some good site to learn from.
if(wallLeft < marioLeft && wallLeftWidth > marioLeft)
{
}
else
{
newLeft = marioLeft - 5;
mario.style.left = newLeft + "px";
}
//else if(wallLeftWidth < marioLeft && wallLeftWidth > marioLeftWidth)
{ }
else
{ //some code }
else-ifshould come beforeelseelse { .....statement should be at last...if...else if...else. You can have as manyelse ifas you want, but there can only be oneelsestatement at the very end. There are JavaScript reference guides where you can read about the basic syntax: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…