I am a moderately experienced Construct developer who is assembling a sample platform game as part of a lesson for my game design students. As part of this game, I've added the ability to toggle the visibility of collision boxes by hitting the TAB key. The code works, but I'm confused by how C3 visually depicts the ELSE statement.
This is the code that works:
Figure 1. ELSE statement on a separate line
|
This is the code that does not work:
Figure 2. ELSE statement is visually indented. |
Visually, it seems like the option in Figure 2 makes more sense; indentation suggests that the ELSE statement is linked to the condition check that happened on the first line. Of course, when the code in Figure 2 is executed, C3 says 'An else condition cannot be placed here. Make sure the event follows a non-triggered event and is the first condition."
I can totally work with this, but I'm trying to figure out how to explain the visual notation to the students. When I do it the *correct* way, as in the Figure 1, the ELSE statement appears as an independent line on the event sheet. In many programming languages, it seems like there would be some sort of visual indication that it is linked to the previous condition check as part of a code block.
For now, I'm just going to say "If C3 sees an ELSE statement on a separate line, C3 will assume that the ELSE is connected to the condition check on the previous line. But you cannot just randomly drop an ELSE statement into the code *anywhere* on the page because C3 cannot figure out what logical check the ELSE is connected to."
Does this make sense? If anyone has other useful ways that you like to think about (or explain) conditional logic, events, and subevents in C3 please let me know.
Thanks!
Aaron