How do I create a custom event trigger?

0 favourites
  • 4 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I tried searching for quite a bit, but either my terminology is wrong or there just isn't much information about this topic.

    I want to create an event condition that acts similar to the built in triggers - if a condition is met during this tick -> do this. For example, I found the built in "Browser -> On Resized" trigger unreliable for my purposes (also I need the exact canvas dimensions anyways), so I wrote something similar to this:

    What I would like, however, is to not have to manually set the boolean to false at the end there, but instead automatically do that the the end of a tick, making sure that events that check that boolean would have time to run. How would I go about that? If there are any other solutions I'm open for suggestions.

    Thanks!

    Tagged:

  • To do something at the end of a tick, use system-wait: 0

  • Use a function instead of using the boolean. If your condition is met on a tick then the function will be called and the events that you place in the function will run. If your conditions are not met then the function will not be called.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Using a function is fine, however, in this case that would be the same as ploping my code directly on the condition check and not something I want. On a smaller project it might pass, but when it spans multiple event sheets where I want different code logic to stay grouped together I prefer to do a "trigger".

    I am familiar with the "wait 0" approach and it does in fact work, being confirmed by Ashley multiple times, yet it still seems so hacky to me, I don't know why we can't have "wait end of tick" or "wait next tick" kind of actions to make it official.

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