Help with Constant Variables?

0 favourites
  • 9 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Not sure if my topic title helps at all but basically I have run into a problem and I am pretty sure I know what is causing it. Take a look.

    The variable CurrentLayout is always true. How do I make it so when the variable is updated, all events related to that are only "Ran Once" sort-a-thing?

    Thank you!

  • Try to add the "Trigger Once" condition It will trigger "once will true".

  • I was about to say the same thing.

  • Joskin there is no way to "Trigger Once". Its constantly true.


    Here is what I did. Still not working.

  • From the manual :

    Trigger once while true

    Turn an ordinary event (which is tested every tick) in to a trigger. For example, if an event plays a sound when lives equals 0, normally this event runs every tick. This plays about 60 sounds a second and would sound pretty bad. Adding Trigger once while true after the other conditions makes the event run just once when it first becomes true. This makes the previous example only play a sound once the first time your lives reaches 0. It must be the last condition in an event.

    So normally it should work if you place the trigger once after the condition !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This may not work because you change layout. It is possible (i'm not sure) that the "once while true" doesn't work between layouts. In this case, functions is the way to go. Keep updating "currentLayout" like you do, but after substracting/adding one to currentLayout, call a function "changeLayout" in witch you put all the other events. Remove the "once while true" if you do so.

    This way, those events won't be evaluated every tick, but only when the user clicks on sprLeft or sprRight.

  • Never used Functions before. Guess it's time to learn.

  • Tekniko it doesn't work with the trigger once after the condition CurrentLayout = x ?

  • Alright, here is what I came up with. Everything seems to work now. Thank you all! Joskin Guizmus

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