Problem with relatively simple events

0 favourites
  • 13 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • Hi, I'd appreciate some help with this.

    Pls. take a look at url: http://occupy.bitballoon.com/

    The small blue squares looks to occupy the big squares for 3 seconds at a time. A big square can only be occupied by one blue square at once. The big squares are colored green when unoccupied and red when occupied.

    The problem is that after a while, at an arbitrary point in time, some of the big squares enters a permanent occupied state with no occupants.

    Events:

    Capx: https://drive.google.com/file/d/0B6WdU53eEV7JcUdwRWd0eUlaZWc/view?usp=sharing

    Edit: capx link fixed.

  • Looks like you linked the wrong file. Chances are you have multiple hits at the same time, so you aren't trimming that down to only a single one. Try a "Pick instance 0" in event 4, or as a sub-event.

  • I did, thanks. This is the right one: https://drive.google.com/file/d/0B6WdU5 ... sp=sharing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Also, similar issue with the timer. Since more than one can timeout at the same time, you need to cycle through them.

  • Yes, it is the timer which is the problem, and I can see why now. Thanks a lot!

  • Also, similar issue with the timer. Since more than one can timeout at the same time, you need to cycle through them.

    http://www.blackhornettechnologies.com/ ... t_BHT.capx

    Oh man. More work arounds.

  • Isn't it correct that triggered events (contrary to std. events), are triggered immediately by a single object instance? I thought that if multiple triggered events fire (semi)simultaneously, they would be handled like a stack in programming. In other words, instance filtering wouldn't be necessary in triggered events. Of course the triggered timer event suggests I'm wrong, but megatronx comment confuses me a little, as I had problems with timers around a year ago, and started using my own, until a couple of weeks ago.

    For example in my code from above - the block where I use the triggered collision event. I'd expect that if multiple sprite3 collided with sprite2, a stack of triggered events was created, and not one triggered event where I had to filter instances. Is this wrongly understood? Because it seem to work as is:

    ---

    The std. overlap event would also result in correct behavior according to my original goal, if modified as follows to filter instances:

  • I'm confused now too.

  • Manual:

    [quote:q180nccu]On timer

    Triggers either regularly, or once off, after a timer that was started with the same tag has reached its duration. NOTE: this trigger can fire with multiple instances picked, if their timers all reach their time in the same tick. This can sometimes work unexpectedly if the actions expect there to be just one instance picked. The workaround is to add a For each condition after this trigger to ensure the actions run once per instance.

  • Manual:

    [quote:2ghr2vne]On timer

    Triggers either regularly, or once off, after a timer that was started with the same tag has reached its duration. NOTE: this trigger can fire with multiple instances picked, if their timers all reach their time in the same tick. This can sometimes work unexpectedly if the actions expect there to be just one instance picked. The workaround is to add a For each condition after this trigger to ensure the actions run once per instance.

    It might be because of late hour here, but in this case, then there's has to be another condition that will lock out those that are not meeting the timer condition, right?

    Let's say you want to destroy object on timer. Number of them triggers simultaneously. What would you do to avoid destroying all objects (because of For each condition)? And now I know what was causing those random issues in my projects. And I wasn't expect this to be it, since it is counter intuitive.

    Ashley Hope that it is going to be fixed in c3, with stacking up objects.

  • The whole point of For each is to pick only one object at a time - how would all be affected?

    Edit: only those items that have timed-out at the same time will be picked when entering "On timer". From there, For each will cycle just them.

  • The whole point of For each is to pick only one object at a time - how would all be affected?

    Edit: only those items that have timed-out at the same time will be picked when entering "On timer". From there, For each will cycle just them.

    Oh, ok, didn't realise that, as I've been thinking linearly downwards. Usually I'd do For each first and then condition/s filtering the objects. AS an example:

    For Each, Boo = 1 would be the same as Boo = 1, For each , or if not, then why? Thx

  • Apparently timer is a special case, so I would just do exactly what the manual recommends.

    But in general how you want to filter, depends on what you are comparing in your conditions. My code in the previous post is a good example on that.

    If you for instance only want to filter based on instance variables for one objects instances, you don't need 'for each'. Say you have a sprite with two instance variables, and want to filter on their value, this would do;

    sprite1 hitpoints = x

    sprite1 state = y

    Then you would end up with all the instances having these values.

    But if your conditions for example involve comparisons between 2 objects and multiple instances from each, you have to be more careful, and think about exactly what you want (revisit my previous post for example on exactly this).

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