How do I Check the Smallest UID/IID?

Get help using Construct 2

Post » Tue Mar 10, 2015 6:10 am

There are lasers hitting asteroids.
When a laser hit an asteroid, I want to check whether the asteroid UID/IID is the smallest among other astroids. How to do that?
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Tue Mar 10, 2015 7:11 am

Maybe my decision is very bold.. but..

On laser collision with asteroid do: System -> Compare two values
If you check by IID, smallest will be always 0. So check if asteroid.IID = 0 then...

Also on collision you can assign var HitID = asteroid.UID
Then just make some loop:
Code: Select all
Var min = 255
System -> For each asteroid
     if asteroid.UID < min
          min = asteroid.UID

After loop end check, if min = HitID, you collide smallest UID asteroid.
B
8
S
1
Posts: 72
Reputation: 606

Post » Tue Mar 10, 2015 7:22 am

thank you
B
10
S
5
Posts: 220
Reputation: 1,464


Return to How do I....?

Who is online

Users browsing this forum: dop2000, TRMG and 14 guests