• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Affect Single Instance (RESOLVED)

R

Rosealine

Guest
I have 10 instances that work on an AI that I need variables changed when they hit a specific object but ONLY when they hit the object individually.

An example would be I have an enemy that when colliding with a trigger its variables are affected but not the other 9 instances of the enemy. it seems simple but i have a general trigger object so simple doing:

obj_enemy.x = obj_trigger.x;

i need the specific enemy instance variables to change when colliding with the specific trigger instance
 

Simon Gust

Member
You can make use of collision_ functions, they return the id of the invidual instance upon collision.
Though your code seems to be in the enemy itself. So this may already work:
Code:
x = obj_trigger.x;
 
R

Rosealine

Guest
You can make use of collision_ functions, they return the id of the invidual instance upon collision.
Though your code seems to be in the enemy itself. So this may already work:
Code:
x = obj_trigger.x;
Thank you but I just needed you use x = other.x

to summarize, if the collision event was in the enemy the enemy object coming in contact with a trigger object would set its x equal to (as an example) one of three trigger objects at random and would perpetually repeat between all of them indefinitely
if the collision event was in the trigger object and i did obj_enemy.x = x all enemy objects would go to that x position rather than just the one enemy i want.

using the collision event in the trigger and doing other.x = x moves just that one instance of the enemy to the x position

[all of this is here for others who may have this problem]
 
Top