This is the only issue im having currently with my scripts, im not sure if its the drawing order but ive tried to rearrange my drawing. If y’all can help me so that I can fix this issue that would be greatly appreciated .
function gameloop() {
// Clear the canvas
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Draw background elements
// Set timeout to hide symbols after 5 seconds
bg.draw();
cloudBig.update(ctx);
cloudBig2.update(ctx);
backgroundLevel1.draw();
water.draw();
waterSmall.draw();
waterSmallTwo.draw();
palmTree.draw();
palmTree2.draw();
palmTreeSide.draw();
palmTreeSide2.draw();
// Draw the p1Symbol
playerUpdate();
p1Symbol.draw(); // Update game objects
p1Symbolp.draw(); // Update game objects
// p1update();
// p1pupdate();
p2Symbol.draw(); // Update game objects
p2Symbolp.draw(); // Update game objects
enemy.enemyMovement();
player.movement();
// Update hurtboxes
player.updateHurtbox();
enemy.updateHurtbox();
// Draw game objects
player.update();
player.draw();
enemy.update();
enemy.draw();
// Check collisions
attackCollision();
enemyAttackCollision();
// CollisionBlocks.forEach(block => {
// block.draw();
// });
// Request the next frame
window.requestAnimationFrame(gameloop);
}
// Start the game loop
gameloop();
I mentioned that ive tried rearranging my drawings. So not sure what’s causing this issue.