You should only use function draw() one time. Try replacing both functions with this code:

function draw() {
  background("white");
  if (keyDown("left")) {
    ghost.setAnimation("ghost_walking");
    ghost.mirrorX(+1);
    ghost.x = ghost.x - 1;
  } else if (keyDown("right")) {
    ghost.setAnimation("ghost_walking");
    ghost.mirrorX(-1);
    ghost.x = ghost.x + 1;
  } else {
    ghost.setAnimation("ghost");
  }
  drawSprites();
}

Zeldaria np! if you like a post that someone made, hover over it and click the up arrow to send an Upvote.

um when I tried to add a function called 'scare' to my game featuring the ghost, the 'walk' function (the one u helped me fix before) stopped working. I ran multiple tests and even removed the scare function, but it still doesn't work...

oof i think ill be able to remix that and then help you out. sound good?

I put the 'scare' function back in so yeah, maybe u can fix it

wait now I did it (put the function back in)

Chat