Which events runs faster ?

Just started using Construct 2? Post your questions here

Post » Tue Apr 05, 2016 11:24 pm

Hello,

Let's say I have 50 bullets with an internal variable named "Color"
I was wondering between these 2 series of events which one would run faster:

-Bullet.Color == 1: Action X
-Bullet.Color == 2: Action Y

-------------------------------------------

-For Each Bullet
+ Bullet.Color == 1: Action X
ELSE Bullet.Color == 2: Action Y

The 2nd seems to have less comparisons but I am unsure how C2 instance selector works. Can you help me please ?

Thanks a lot
B
5
S
1
G
1
Posts: 24
Reputation: 538

Post » Tue Apr 05, 2016 11:44 pm

The official answer is... don't worry about it!
https://www.scirra.com/blog/83/optimisa ... -your-time

If that is not satisfactory, this post has a little more details about what really does matter in terms of performance.
https://www.scirra.com/manual/134/performance-tips

On a side note, I'm going to guess that maybe you are misunderstanding the "For Each" and "Else" conditions, so I'll leave these here for your reference just in case you haven't read them yet.
https://www.scirra.com/blog/141/common- ... nd-gotchas
https://www.scirra.com/tutorials/292/gu ... t-features
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Wed Apr 06, 2016 1:21 am

Not sure if I undestand correctly but:

System > Pick by comparison
param 1: Bullet.color
param 2: 1 (or any value you want)
> Action X

EDIT: and select object Bullet in "Pick by comparison" ofc.
ImageImage
B
27
S
16
G
69
Posts: 947
Reputation: 39,103


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests