Working with Groups...

0 favourites
  • 3 posts
  • To keep my C2 code simple, clean, and easy to read, I like to put ALL my code into Groups. When an event in that Group is resolved I deactivate it and activate the next one. Sometimes I have to leave a Group open until events have resolved... This FSM-style methodology works very well for me but I ran into an obscure bug recently and I'm wondering about the best way to prevent this problem in the future.

    My issue occurred when I switched to a new layout and then back again. I expected the layout to basically "restart" but I apparently had a Group open (from before) and that code was executing out of order. Anyone else run into this? I don't think there's a programmatic way to Activate or Deactivate all groups, right? I could do it on a Group-by-Group basis but I have a lot of Groups.

  • To keep my C2 code simple, clean, and easy to read, I like to put ALL my code into Groups. When the events in that Group are resolved I deactivate it and activate the next one. Sometimes I have to leave a Group open until events have resolved... This FSM-style methodology works very well for me but I ran into an obscure bug recently and I'm wondering about the best way to prevent this problem in the future.

    My issue occurred when I switched to a new layout and then back again. I expected the layout to basically "restart" but I apparently had a Group open (from before) and that code was executing out of order. Anyone else run into this? I don't think there's a programmatic way to Activate or Deactivate all groups, right? I could do it on a Group-by-Group basis but I have a lot of Groups.

    I did not encounter but I think making separators like Universal Groups (Always Active) and Local Groups (Can be deactivated) can prevent this or separating event sheets per layout or per category will also be good. But if it is really a bug and if you can prove it then you should report this as a bug in the Bug Section of this forum but remember to provide a .capx file or it will be marked as closed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply. No, I don't think it was a C2 bug... just a bug with my app.

    [quote:ur8xa0yk]I did not encounter but I think making separators like Universal Groups (Always Active) and Local Groups (Can be deactivated) can prevent this or separating event sheets per layout or per category will also be good.

    I'll explore that a bit more. Thanks for the suggestion.

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