Why does the order of the events affect the program?

Get help using Construct 2

Post » Mon Nov 28, 2016 7:17 pm

I have many events in my event sheet. Many of them are connected with each other and they cause bugs when they are in a certain order. If I try moving their places (like, more closer one to another), they work properly, just as I want them to. But, if they are further one from another, they cause very stupid problems for which I waste hours examining my events, even though everything's in the right place.

So why does the order of the events affect their actions?? Is there a solution for this?
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Mon Nov 28, 2016 7:25 pm

It all depends....on many things.

Are they sub-events? Conditions?

Events/actions are read from top down.

Think of throwing a ball at a window. The window can't and won't break unless the ball is thrown first. And then if there are other things preventing the ball from hitting the window. Such as a person walks in between the ball being thrown and the window. The ball won't ever hit the window because it hit the person first.

It took me a long time to understand this. Even now, i have to look over my logic to make sure everything is in its right order.


Maybe you could upload a capx or screenshot, we'd be able to better help.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Mon Nov 28, 2016 7:59 pm

And what about events that occur every tick, but can't be merged into one event?

I have used many softwares but this is something new for me.

And yes, I'm not talking about sub-events or conditions, I'm talking about separate events.
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Mon Nov 28, 2016 11:15 pm

It is because the engine logic is sequential and based on a single core. Which means the code reading have a start and an end. Using multiple cores to read the same code would cause many logic problems. For everything else though It already uses multiple cores but not for the events.
Ashley posted about this a while ago.
https://www.scirra.com/blog/ashley/20/w ... n-one-core
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Tue Nov 29, 2016 3:22 pm

Just remember that things are executed top down in the event sheets and there shouldnt be any problems. If things dont work properly because they are spaced too far apart it just means you have events in between that affect your conditions.
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Wed Nov 30, 2016 12:12 am

What can affect an "Every Tick" condition?
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Wed Nov 30, 2016 9:28 am

RobertMKD wrote:What can affect an "Every Tick" condition?


Not sure your question make a lot of sense?

An every tick condition is what happens by default if an event in C2 doesn't have any conditions that would change the rate at which it is checked. By default this is 60 times a second. So when you ask what can affect an "Every tick" condition, the obvious answer would be nothing, as it have nothing that can be affected . But im pretty sure that weren't what you meant with the question, can you elaborate? :)
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Sun Dec 04, 2016 2:47 pm

GenkiGenga wrote:Just remember that things are executed top down in the event sheets and there shouldnt be any problems. If things dont work properly because they are spaced too far apart it just means you have events in between that affect your conditions.


The question was refered to GenkiGenga's post.
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Mon Dec 05, 2016 9:52 pm

All root events execute on every tick (without extra conditions), whether you specify "Every Tick" or not.
GenkiGenga wrote:Just remember that things are executed top down in the event sheets and there shouldnt be any problems. If things dont work properly because they are spaced too far apart it just means you have events in between that affect your conditions.

I don't think this is true.

The only synchronous events are those underneath a global event. All of the global events execute asynchronously every tick, so you have no guarantee of execution order for non-conditioned global events.

EDIT: Although, I can't seem to build a basic Construct capx that shows this... so, it may be true.
They definitely execute every tick though (or as quickly as possible).
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Tue Dec 06, 2016 12:10 am

It's true, events are run top to bottom. However triggers (they have a green arrow to the left) are only run when they are triggered, but if there is more than one of the same trigger they are run top to bottom. Basically you could move the triggers around and the game will run the same as long as they have the same order. "on collision" and the gampad triggers are the exceptions. They are not real triggers, and are run in order with everything else in the event sheet.
B
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests