• 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!

Instance Create at Collision Point

G

ggiles892

Guest
How would I create an instance in the collision event between two objects? I want an effect I created to be created right at the point of collision between the two objects.

So in Collision Event....

var collideLocationX;
var collideLocationY;
instance_create(collideLocationX, collideLocationY, object_effect);

-How would I find the value of those two variables?
 
A

Aura

Guest
http://gmc.yoyogames.com/index.php?showtopic=389229

That should get you started, but let me warn you that it is very performance expensive, so if you can avoid using it, do so. You could also use cheap positioning checks to determine the side of collision. For example, if an instance of obj_Player is above an instance of obj_Wall during a collision, you might create an instance of the effect object at the top of the wall instance. But that might or might not work depending on the type of game you're working on.
 
J

JFitch

Guest
If you know the objects both are the same size and both have the center as the origin, the collision point is the midpoint of their coordinates.
 
D

DominionUniverse

Guest
Has a simple solution for this ever been determined? I'm trying to add an explosion effect at the point of collision between bullet mask and target mask and for the life of me I can't figure it out.
 
D

DominionUniverse

Guest
Nevermind, just as I hit send I realized I just need to change the bullet instance to the explosion effect instance upon collision lol. JFC
 
Top