How do I start an action with a objects with different UIDs?

Just started using Construct 2? Post your questions here

Post » Wed Feb 14, 2018 8:15 pm

Hey, I would like to know how to trigger an action with 2 or more instances of the same object, that will destroy 2 instances of another object.

So far, I thought it would work like this:

Thing Pick instance with UID 001
Thing Pick instance with UID 002
Thing is True
Stuff Pick Instance with UID 03 -> Destroy Stuff
Stuff Pick Instance with UID 04 -> Destroy Stuff

Any tips?
B
12
S
2
Posts: 34
Reputation: 716

Post » Fri Feb 16, 2018 1:42 am

So you need pick 2 instances of Thing, check if some boolean instance variable is true for both of them, and then destroy 2 instances of Stuff?

You can do this:

Code: Select all
System pick Thing by evaluating ((Thing.UID=1 | Thing.UID=2)  & Thing.someBoolean=1)
          Stuff Pick Instance with UID 03 -> Destroy Stuff
          Stuff Pick Instance with UID 04 -> Destroy Stuff


It's a bad habit to use fixed values for UIDs in your code, you should use instance variable "ID" instead.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
156
Posts: 2,204
Reputation: 82,989


Return to Beginner's Questions

Who is online

Users browsing this forum: ultrafop and 0 guests