events run in groups even after deactivation

This forum is currently in read-only mode.
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Is this how it's supposed to work? It seems conditional: mouse clicks in a group of events won't run after a 'deactivate this group' command is run, but if an object collides with another object in a later event after construct has been told to deactivate the group, the event still runs. Such as:

    Group 1

    Always set sprite y to sprite.y+1

    Sprite overlaps sprite 2: System: Disable group "Group 1"

    Sprite overlaps sprite 2: Sprite: rotate 10 degrees clockwise

    ...the sprite still rotates. I would prefer construct stops running events in a deactivated group, rather than continuing through and deactivating upon the next run-through.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there an earlier event triggering the group back on, conflicting? Ya know, like the button color change thread from a few days ago?

  • In the example I wrote, no. There's no event to activate the group at all. I'm sure you meant in the game I found this with, but the example shows what I mean. In the game I'm working on, the events to activate that group are later in the group that's supposed to be deactivated, so they shouldn't run.

  • upload the .cap I think

  • Well, the activation of a group currently acts like a big 'if' statement. The activation state of the group is only checked at the top of the group, and if it is activated, all its events get run. Consider the event:

    + Global variable 'Myvar' = 0

    Action 1

    Set 'Myvar' to 1

    Action 2

    Even though the action 'Set 'Myvar' to 1' makes the condition of the event false, this does not cancel the running of the event; Action 2 is still run even though the event is no longer true. It's simply because the conditions are checked once only, and all actions are run when that check is true.

    The logic is the same with groups, and I'm not convinced it should be changed, since this behavior exists in other places in Construct. You could work around it by adding 'Group is activated' conditions to the subsequent events after a deactivate.

  • Edit: misread reply.

    There are a whole lot of events after those, though. Doesn't that kind of make it a little redundant, asking an event to check if the group it's in is even active? Isn't that the point of deactivating the group?

    Regardless, I'm happy to use the 'group is activated' condition - I can't find it anywhere, though.

  • Haha, I think I forgot to add that condition

    I'll put it in the next build. You can also make all the rest of the events in the group a subevent to a "group is activated" condition - when it's done - saving you repeating the condition in every event.

  • Oh, great idea. Much appreciated!

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