A
AtomicToilet
Guest
Howdy folks. When my player (obj_player) collides with an enemy (obj_enemy) I get this Fatal Error message and I can't for the life of me think why, because nothing happens to destroy or remove obj_player:
------------------
The Draw GUI code doesn't cause issues at any other point, and likewise, I have the enemy collide with the player when he's in a different state (ie. attack) and nothing untoward happens - this error message only appears when the player collides with the enemy in his default state (or he changes back from obj_player_attack and he's still touching obj_enemy).
(Incidentally, obj_player_attack is a child of obj_player and when triggered away from an enemy doesn't cause problems)
This is the Collision with obj_enemy code (used in obj_player):
I haven't used GM in a few months so I'm a bit rusty - am I missing something really obvious? Cheers for any help!
------------------
---------------------FATAL ERROR in
action number 1
of Draw Event
for object obj_gui:
Unable to find any instance for object index '4' name 'obj_player' at gml_Object_obj_gui_DrawEvent_1 (line 2) -
draw_sprite_ext(spr_health_fill,1,view_xview[0]+16,view_yview[0]+5,obj_player.health/100,1,0,c_white,1);
The Draw GUI code doesn't cause issues at any other point, and likewise, I have the enemy collide with the player when he's in a different state (ie. attack) and nothing untoward happens - this error message only appears when the player collides with the enemy in his default state (or he changes back from obj_player_attack and he's still touching obj_enemy).
(Incidentally, obj_player_attack is a child of obj_player and when triggered away from an enemy doesn't cause problems)
This is the Collision with obj_enemy code (used in obj_player):
And, in case it's needed, the GUI code:if (sprite_index = spr_player) or (sprite_index = spr_player_recharge)
{
energy -= 20;
}
else
{
other.spd = 0;
other.image_blend = c_fuchsia;
}
----------------------------------------draw_sprite(spr_health_bckgrnd,1,view_xview[0]+15,view_yview[0]+5);
draw_sprite_ext(spr_health_fill,1,view_xview[0]+16,view_yview[0]+5,obj_player.health/100,1,0,c_white,1);
draw_sprite(spr_health_border,1,view_xview[0]+15,view_yview[0]+5);
draw_sprite(spr_energy_bckgrnd,1,view_xview[0]+5,view_yview[0]+5);
draw_sprite_ext(spr_energy_fill,1,view_xview[0]+6,view_yview[0]+5,obj_player.energy/100,1,0,c_white,1);
draw_sprite(spr_energy_border,1,view_xview[0]+5,view_yview[0]+5);
I haven't used GM in a few months so I'm a bit rusty - am I missing something really obvious? Cheers for any help!