Visible/Invisible layers and objects

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • This is perplexing for me. I have 2 layers. On layer 0, there is a sprite (equal sign). On layer 1, there is a sprite (save button). Using touch, on touch object on layer 0, do whatever and go to layer 1. It then makes layer 0 invisible and layer 1 visible. The thing is, the save button on layer 1 is activated by the same touch from layer 0.


    -layer 0 is visible initially

    -layer 1 is invisible initially

    -both buttons are in the same position and same size

    What am I doing wrong? It's almost as if it holds onto the touch for all layers and when they become visible, it applies it. Not saying that is what is actually happening, but that's what it seems like.

  • You probably need to add a cooldown. Without seeing your events I'm just guessing, but I'm imagining you probably have the issue that when the user touches a button, the layer changes, and in the same tick, they are also now touching the new button since a touch is true for the entirety of the tick.

    Add a cooldown timer so the game will only allow 1 button press every second or 0.5 second or whatever and that will probably fix it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for pointing that out. So I added some time and it didn't fix the issue. There is something funny going on with what I have so I just have to figure it out. At least I can rule the problem I described out thanks to your suggestion.

  • Just because a layer is invisible, doesn't mean that it isn't interactable. If the buttons are in the same place, then you are hitting both at the same time. You then end up with a classic toggle problem - If A then B, if B then A - Both will run, resulting in A.

    Use else, or add the "layer is visible" condition to your button event.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)