There is a way to make a Sprite desappear when i'm on a Menu interface, and after, it appear again?

I'm making a game with my friend witch has a interface menu, although when i run the menu code with the game code, we can see all the sprites moving around on the menu. So there is any way to make theses Sprites desappear? Ah, just a little reminder, the menu code is going inside the draw function with the game, like:

function draw() {
  if (menuOn === false && instructions === false) {
  } else if (menuOn === true && instructions === true) {
    menu2(); // menu2 is the instructions //
  } else {
    // the game is going to be here//


  • Answer ✓

    I'm assuming your drawing your sprite's using the image() function. so just change it to something like this

    if (menuOn == false) image(yourImage, Xpos, Ypos);

    that way your sprites will only be drawn when the menu isn't on, I also recommend doing the same with key presses (if thats how you move your sprites around) otherwise the player will still be able to move the sprites even though he cant see them

  • Thank you so much (:

Sign In or Register to comment.