Artie_Kyle
Member
What up GMC!
The title says it all; I've been trying to damage and enemy only when I fire bullets at its back so it acts as the weak spot, but I can't quite get the code to run.
Here's the code, let me know what I'm doing wrong:
For the record, the damage script works like a charm with all the other enemies, so I know its not the culprit here, but probably the place_meeting code, although I still can't quite come up with the fix.
As always, thank you all for your time!
The title says it all; I've been trying to damage and enemy only when I fire bullets at its back so it acts as the weak spot, but I can't quite get the code to run.
Here's the code, let me know what I'm doing wrong:
Code:
// code belongs to the bullet object, in the collision event with the boss object
var _left = place_meeting(x-1, y, obj_boss);
var _right = place_meeting(x+1, y, obj_boss);
if _right and obj_boss.sprite_index == spr_boss_standing and obj_boss.image_xscale == 1 {
scr_damage(20, obj_blood_grey);
}
if _left and obj_boss.sprite_index == spr_boss_standing and obj_boss.image_xscale == -1 {
scr_damage(20, obj_blood_grey);
}
instance_destroy();
As always, thank you all for your time!