Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

CansomebodypleasetellmewhyIcaninfinitelyjumpandwhytheplatformsarentworking

Error is somewhere in update function. Also, I'm not sure why these errors are happening. Can somebody please help me fix these? I have no idea what could be causing the errors, but I think it is in the update function.

setInterval(update,40)

function update(){
    var colliding = false
    gravity = 10
    ctx.fillStyle = 'lightblue';
    ctx.fillRect(0,0,canvas.width,canvas.height);

    if (player.a){
        player.position.x -= 7;
    }
    if (player.d){
        player.position.x += 7;
    }

    player.position.y += gravity

    player.spawn();

    for (key in platforms){
        platforms[key].spawn()
        if (intersectRect(player,platforms[key])){
            colliding = true
        }
    }

    if (colliding){
        player.canJump = true
        player.isJumping = false
    }

    testCollision(player)
}

Comments