Variable Equations

New releases and general discussions.

Post » Sat Jan 19, 2013 11:08 pm

Hey, I'm wondering if the is a way to use a object's variable in a piece of code. For Example:

Bullet collides with Enemy
Subtract Bullet's damage variable from Enemy's health

Basically, I made all my bullets in one family and made each bullet do different amounts of damage. Is there anyway I can just call the family member that is colliding and use it's damage variable to subtract health from the object it's colliding into?
B
4
Posts: 11
Reputation: 322

Post » Fri Jan 25, 2013 6:42 am

Of course.

If you use the "on collision" trigger, both objects that are colliding are picked. So if you use that trigger with a family, only that member of the family is picked. Instead of bullet('damage') you'd use family('damage'), that's it.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Jan 28, 2013 6:50 pm

Thanks a lot. I figured it was possible but I wasn't sure how it was written.

Again, Thank you!
B
4
Posts: 11
Reputation: 322


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests