OR does not work

Discussion and feedback on Construct 2

Post » Fri Dec 30, 2016 11:46 pm

Hello, I do not know why this happens, I am pressing right cursor + C key, this causes var to be 10 at the first tick, however the sprite is not destroyed.

The sprite should be destroyed since var is 10 for a tick.

Image

https://dl.dropboxusercontent.com/u/60803633/testKeys.capx
B
29
S
12
G
21
Posts: 782
Reputation: 14,413

Post » Sat Dec 31, 2016 12:20 am

The "OR" works perfectly.

What causes it to not work is the "C" and "V" events.
They are events (marked by an arrow) and differ from conditions.
Conditions trigger each tick when they are true while events only trigger once as soon as they are true.

You can simply change the "C" and "V" events to "Key is down" conditions.
It will work then.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sat Dec 31, 2016 12:59 am

That or should work when the trigger is true and a cursor is being pressed
B
29
S
12
G
21
Posts: 782
Reputation: 14,413

Post » Sat Dec 31, 2016 1:02 am

Exactly the same problem as you had here:
something-strange-with-conditions_t182765

A trigger bumping on an 'else' while looking up if it is allowed to run its actions/subs.

Only in these case randomly has an easy fix.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Dec 31, 2016 1:10 am

Oh an by the way .....

When fixed (triggers replaced) that is just a genius event.

... takes hat of ... bows ...
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Dec 31, 2016 1:11 am

Triggers do not run in-line with the rest of the code. They run outside of the loop, so you can't bury them that way and expect it to work. Place the triggers at the top and call a function and have that check for the arrow keys.
ImageImageImage
B
71
S
21
G
230
Posts: 3,688
Reputation: 128,847

Post » Sat Dec 31, 2016 7:54 am

Ok guys, thanks to all.
I changed the trigger for "trigger once" and now it works even if it is in the "else"
B
29
S
12
G
21
Posts: 782
Reputation: 14,413

Post » Sat Dec 31, 2016 5:07 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to Construct 2 General

Who is online

Users browsing this forum: CrudeMik and 1 guest