Do I really avoid ELSE statements in this situation?

Just started using Construct 2? Post your questions here

Post » Fri Oct 21, 2016 2:25 pm

Imagine a simple scenario involving a hero, a monster, and a sword.

If the hero has picked up the sword, collision with the monster kills the monster.

If the hero has not picked up the sword, collision with the monster kills the hero.

Currently, I have two almost identical code blocks: one kills the monster if the boolean is true and the second kills the hero if the boolean is false.

Is there any way to use an ELSE statement in this situation?

Thanks!
B
10
Posts: 25
Reputation: 406

Post » Fri Oct 21, 2016 2:53 pm

something like this?

Image
Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Fri Oct 21, 2016 3:37 pm

Yes. Exactly. But when I try to add the boolean check (is hasSword), it doesn't indent the condition under the first condition. Nor do I get a system condition labeled ELSE.

Aha. Figured out that I need sub-events and can select them from the events menu. Is there a short-cut for this? The manual says to right-click in the event margin but this doesn't seem to work.

Thanks for the help.
B
10
Posts: 25
Reputation: 406

Post » Fri Oct 21, 2016 3:53 pm

Right click on the event you want a sub on.
English is not my native language. Sorry for any mistakes and feel free to correct me if needed.
B
14
S
5
G
3
Posts: 113
Reputation: 3,231

Post » Fri Oct 21, 2016 3:54 pm

Image
Image
Image

or just click on event and press "S" on keyboard
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sat Oct 22, 2016 5:01 pm

Thank you! This is exactly what I needed to know. This is super helpful, and I appreciate the prompt response.
B
10
Posts: 25
Reputation: 406


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests