C
Carcophan
Guest
Hello everyone.
I am new to GML and GMS2 but am in love with everything and the amazing community.
So, I am already able to successfully shoot a projectile object, from the players location/gun, towards the mouse click location/enemy. (In a top down 2D shooter type game).
However, I am looking for a way to destroy the bullet(s) object AT the location I clicked (the X/Y) instead of just flying off in a strait line off the screen forever.
Note that, this is NOT in the event of a collision with the enemy object, but at the defined mouse click location itself. Destroy Projectile_01 specifically when it gets to the mouse click location of X100 Y100, versus on collision with Enemy_object_01.
I have tried several things, and this latest example here 'should' work, but it isn't. The bullets just keep flying strait forever, on an enemy miss.
This is currently also in the 'End Step' of the Bullets object, as an FYI.
Anyone have any pointers or suggestions?
Thanks!
I am new to GML and GMS2 but am in love with everything and the amazing community.
So, I am already able to successfully shoot a projectile object, from the players location/gun, towards the mouse click location/enemy. (In a top down 2D shooter type game).
However, I am looking for a way to destroy the bullet(s) object AT the location I clicked (the X/Y) instead of just flying off in a strait line off the screen forever.
Note that, this is NOT in the event of a collision with the enemy object, but at the defined mouse click location itself. Destroy Projectile_01 specifically when it gets to the mouse click location of X100 Y100, versus on collision with Enemy_object_01.
I have tried several things, and this latest example here 'should' work, but it isn't. The bullets just keep flying strait forever, on an enemy miss.
This is currently also in the 'End Step' of the Bullets object, as an FYI.
Code:
if place_meeting(x,y,obj_bullet)
{
var bullet = instance_place(x, y, obj_bullet);
with (bullet){
instance_destroy();
}
}
Thanks!
Last edited by a moderator: