Some conditions can't be used in one event?

Discussion and feedback on Construct 2

Post » Wed Apr 10, 2013 1:01 pm

I am making a dog simulation game. I had a lot of info about the problem written, but my computer turned off and all I wrote wasn't saved. So shortly:Why can't I use the "on collision with another object" and the "Keyboard: On Z pressed" conditions on the same event?
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Wed Apr 10, 2013 1:12 pm

Of course you can do that, what was the problem ?
B
12
S
3
G
4
Posts: 63
Reputation: 3,410

Post » Wed Apr 10, 2013 1:12 pm

Hard too descripe for me cause Im no native english speaker. So I just tell you how to fix it:

+ Keyboard: On Z Pressed
++ subevent Sprite is overlapping Sprite
--> Do something

It is cause this are 2 "On" Events.
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Wed Apr 10, 2013 2:00 pm

Why can't two "On" conditions be in one event?
A sub-event? Where will all the actions be?
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Wed Apr 10, 2013 2:07 pm

[QUOTE=fassFlash] So shortly:Why can't I use the "on collision with another object" and the "Keyboard: On Z pressed" conditions on the same event?[/QUOTE]

You can't do that , because they are both triggers. Check this manual entry for more indepth explanation.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Wed Apr 10, 2013 2:10 pm

I beg to differ, you can have two triggers in the same event block.

Right click the main event block and make it an 'OR' block. I just tested it and it lets me do it in the editor.
slap it onto the flappy bird template...
bang it on google play with all the other shovelware...
sorted...
B
36
S
7
G
4
Posts: 322
Reputation: 8,170

Post » Wed Apr 10, 2013 2:15 pm

[QUOTE=Wrangler] I beg to differ, you can have two triggers in the same event block.

Right click the main event block and make it an 'OR' block. I just tested it and it lets me do it in the editor.[/QUOTE]

Absolutely, but functionality would not be what I'd imagine he is aiming for :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Wed Apr 10, 2013 2:25 pm

Rrr please dont laugh about my try to explain it you :D Im really no native speaker.

If you make something like:
On collide
-AND-
On key press

They cant exactly trigger at the same time, this is the problem.
"On" are "real" Events, they really trigger only once as soon as you tell it them.
"None Real" Events are something like:

->System compare 1 = 1

This get handled like: Every Tick "if value 1 = 1". in c2 it was just made easier.

Every tick is also a "real" Event the only difference between "on" is that this event get called every Tick not at the moment you tell it him.


If you know how Javascript(This is the language on that C2 is based) works it would be easy to explain it to you.


You only really need to know that On is a call and not a condition.


Hope it helps you a bit, if not just wait till any native speaker got time to explain it to you :D

Darklinki2013-04-10 14:26:32
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Wed Apr 10, 2013 2:40 pm

Pretty clear explanation

I thought it was possible to do this in the same event like

if (collide AND ZPressed){
Do Action
}

But as soon as they are "real" events, yes i understand why it would'nt work
B
12
S
3
G
4
Posts: 63
Reputation: 3,410

Post » Wed Apr 10, 2013 2:41 pm

An event with two triggers in it is a bit like an event saying "On the exact moment lightning strikes, AND the exact moment the clock reaches midnight". They will effectively never happen at the same time. It's not a perfect analogy though - in Construct 2 triggers always fire one at a time, so rather than being highly unlikely, it's actually impossible that any such event could ever run.

You most likely just want to have this instead:

+ On collision
+ Z key is down (not 'on pressed', the 'is key down')

or this:

+ On Z key pressed
+ Sprite is overlapping (not 'on collision', the 'is overlapping')
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Eisenhans and 15 guests