Events and giant boolean structures

Discussion and feedback on Construct 2

Post » Thu May 15, 2014 3:07 am

Hey, I have a sort of silly question:

Is it okay to have seeming needless booleans in the events that stay true most of the time, and only change once in a while?

Basically things like - IF daytime then do lots of stuff, else if night then do this other stuff. Is there a better way to do that? Can I just have a text variable with a function name that is called (either day or night). would that help improve event structure?

I am asking because I am writing one event sheet and trying to encompass multiple possibilities. Some of my levels are "dark" and so apply lighting differently than normal levels. But I still have to ask wether the level is dark every tick so I can have stuff happen if it is... Does this make sense?

I had heard one event sheet was best. I think it would be better to split the event sheet up into part and have an event sheet that includes event sheet x,y,z... so on for each level. Though that could get out of hand really quickly :(
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,173

Post » Thu May 15, 2014 5:37 am

whether you use one event sheet or more, Global variables effect all layouts no matter what event sheet they are in. If I understand you correctly, create separate variables for different layouts and no it is not every tick.

Just so you know;

Using one event sheet, you could divide code into groups and disable and enable those groups based on the layout.

You also don't have to use a separate event sheet for each layout but, rather use separate event sheets to govern different events.

I still like to use one event sheet for each layout and put everything into a Master Group on each event sheet and disable those groups on the start of layout of the current layout and enable the Master Group of the current layout.
You just have to keep the On Start of layout out of the Master Groups of each sheet.

Hope you can follow that.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,293

Post » Tue May 20, 2014 8:49 pm

Ya thanks, that all makes sense. I already have an initialize group that runs at the start of the layout, I'll try to organize via that and turn certain groups on or off depending on the level. Thanks
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,173


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 1 guest