0 Favourites

On Start Of Layout doesn't work

  • On Start Of Layout action doesn't work after returning from another layout with Go To Layout action.

    On game layout I have game objects and non game objects (like high scores text and words "game over").

    On Start Of Layout event destroys all non game objects, and when game ends I create them again.

    After that I'm going to another layout and then back with Go To Layout action. But On Start event is not working this time, I see same objects that I had on the end of game: high scores text and words "game over". Why it's not destroyed? What I'm doing wrong? Before I was using Reset Global Variables, but right now I can't use it, because different variables loading from WebStorage on different layouts.

    Upd: Thanks for your help guys. Problem was in code - end game action was activating when shouldnt.

  • It's easier you hide and show these non-game objects with a separate layer.

  • You likely have set those objects as global or something.

    Consider posting your capx for further examination, that will be easier to establish what's going wrong.

  • You likely have set those objects as global or something.

    Consider posting your capx for further examination, that will be easier to establish what's going wrong.

    No, it's not global. Maybe I'm wrong and On Start Layout action starts just once - when I first time on this layout, and after that I have to use Restart Layout action?

    It's easier you hide and show these non-game objects with a separate layer.

    I'm not sure will this objects be clickable if they will be invisible on separate layer (or if they will visible on invisible layer)? There is some buttons, and I don't want them to be clickable while game is not over.

  • I'm not sure will this objects be clickable if they will be invisible on separate layer (or if they will visible on invisible layer)? There is some buttons, and I don't want them to be clickable while game is not over.

    Just put these buttons in a separate layer. Turn this layer visible in your game over conditions and invisible in gameplay. Put conditions in your buttons to user click them only when layer is visible.

  • > I'm not sure will this objects be clickable if they will be invisible on separate layer (or if they will visible on invisible layer)? There is some buttons, and I don't want them to be clickable while game is not over.

    >

    Just put these buttons in a separate layer. Turn this layer visible in your game over conditions and invisible in gameplay. Put conditions in your buttons to user click them only when layer is visible.

    Ok I get it, but I looked once again, and I think it won't solve problem. On Start action else have to reset some variables, but it doesn't happens.

  • Then please post your CAPX or a screenshot.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks for your help guys. Problem was in code - end game action was activating when it shouldnt.

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