Bentley
Member
I am making a Space Invaders base, and the base has a sprite that is drawn to a surface, and the surface is drawn at the base's x/y (the draw event overrides the normal drawing of the sprite). But the base does have the sprite assigned to it, and it therefore has a collision mask. The problem is that I can't get the collision event to trigger between the base and a laser, yet I can detect a collision using a place_meeting check. Does anyone know why the collision event does not trigger? (The code is changed when I test it in the collision event. For example, other is used to get the id of the laser instance.)
Thanks for reading.
GML:
if (place_meeting(x, y, o_laser))
{
var laser = instance_place(x, y, o_laser);
var dx = laser.x - x;
var dy = laser.y - y;
if (surface_getpixel(surf, dx, dy) > 0) // If the laser hits the base
{
surface_set_target(surf);
gpu_set_blendmode(bm_subtract);
draw_sprite_ext(laser.sprite_index, 0, dx, dy, 1, 1, 0, c_black, 1);
gpu_set_blendmode(bm_normal);
surface_reset_target();
instance_destroy(laser);
}
}
Last edited: