Apexpredator
Member
Hello all
I have a question. How would i make an object A collision with object B affect Object
C?
I have a question. How would i make an object A collision with object B affect Object
C?
// in obj_a...
if place_meeting(x,y,obj_b)
{
obj_c.variable = true;
}
//;; CREATE EVENT ;;
//BOOLEAN FOR COLLISION CHECK START
collision_trigger = false;
//OBJECT FOR THE COLLISION CHECK
collision_object = noone;
//;; STEP EVENT ;;
if(collision_trigger){
if(collision_object != noone)
//DO THE COLLISION CHECK
collision_point( x, y, collision_object, false, true );
//CLEAR THE VARIABLES
collision_object = noone;
collision_trigger = false;
}
}
//;; CREATE EVENT ;;
//TRIGGER THE COLLISION WITH OBJECT_A AND OBJECT_B
collision_start = true;
//;; STEP EVENT ;;
if(collision_start){
//GIVE OBJECT_B THE COLLISION DATA
var instance_Object_B = instance_find(Object_B, 0);
instance_Object_B.collision_object = instance_find(Object_C, 0);
instance_Object_B.collision_trigger = true;
//DEACTIVATE THE COLLISION TRIGGER
collision_start = false;
}
I think you would have to provide more info depending on what sort of behavior you want.Hello all
I have a question. How would i make an object A collision with object B affect Object
C?
// In the collision event for A and B
// Get the instance of object C you want to be effected and set a variable
instanceOfC.collisionOccuredBetweenAandB = true;
// Now C knows a collision happened and will process it in its next step event
// Object C's step event
if (collisionOccuredBetweenAandB == true) {
// Do stuff you want C to do
// clear out the variable so you know you handled it
collisionOccuredBetweenAandB = false;
}
// In the collision event for A and B
// Get the instance of object C and call a user_event
// make instanceOfC call user even zero
with(instanceOfC) {
event_user(0);
}
// Now C's user event zero will be called which can make C react to the collision