Working with Groups...

Get help using Construct 2

Post » Wed Feb 24, 2016 11:30 am

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.
Last edited by John Cutter on Wed Feb 24, 2016 1:39 pm, edited 1 time in total.
B
11
S
3
Posts: 85
Reputation: 866

Post » Wed Feb 24, 2016 11:47 am

John Cutter wrote: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.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
67
S
22
G
90
Posts: 1,125
Reputation: 60,036

Post » Wed Feb 24, 2016 1:00 pm

Thanks for the reply. No, I don't think it was a C2 bug... just a bug with my app. :-)

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.
B
11
S
3
Posts: 85
Reputation: 866


Return to How do I....?

Who is online

Users browsing this forum: WesleyDeveloper9 and 7 guests