A
Arj72
Guest
I've been working on a 2.5D platformer game for about a week now and I've run into an issue. The main character encounters enemies, called Nuggets, that just walk left in right within designated zones and are supposed to hurt the player when you walk in to them. You can kill them by jumping on them. My problem I am encountering is some of the enemies function properly, and some just walk right by the player, never causing damage. Here is the two different codes, the first one for killing the enemy, by triggering an alarm that destroys it, and the second is where it hurts the player, before once again being destroyed.
if (place_meeting(x,y,obj_player))
{
if (obj_player.y < y-6)
{
with (instance_nearest(x,y, Obj_Nugget))
alarm[0]= .044*room_speed
sprite_index= (Spr_NuggetDie);}
}
----------------------------------------------------------
if (place_meeting(x,y,obj_player))
{
if (obj_player.y >= Obj_Nugget.y)
{
with (instance_nearest(x,y, Obj_Nugget))
sprite_index= Spr_NuggetDie
global.phealth -= 1
alarm[0] = .044*room_speed;}
}
if (place_meeting(x,y,obj_player))
{
if (obj_player.y < y-6)
{
with (instance_nearest(x,y, Obj_Nugget))
alarm[0]= .044*room_speed
sprite_index= (Spr_NuggetDie);}
}
----------------------------------------------------------
if (place_meeting(x,y,obj_player))
{
if (obj_player.y >= Obj_Nugget.y)
{
with (instance_nearest(x,y, Obj_Nugget))
sprite_index= Spr_NuggetDie
global.phealth -= 1
alarm[0] = .044*room_speed;}
}