L
limpet76
Guest
Haven't been doing gamemaker too long, however I have a problem with my coding. This is the code for the enemy:
STEP
"if collision_line(x,y,obTimb.x,obTimb.y,obWall,1,0)
{
move_snap(0,0)
}
else
{
mp_potential_step(obTimb.x,obTimb.y,4,1)
}"
Then this is the code on the player:
COLLISION WITH ENEMY
"hp -= 5
audio_play_sound(sndShooting,1,0)
if hp <= 0
{
global.gameEnd = true
obTimb.visible = false
room_goto(roomGameOver)
audio_play_sound(sndPlayerHit,1,0)
}"
I am getting an ERROR That looks like this whenever an enemy kills the player:
"FATAL ERROR in
action number 1
of Step Event0
for object obZomb:
Unable to find any instance for object index '0' name 'obTimb'
at gml_Object_obZomb_StepNormalEvent_1 (line 1) - if collision_line(x,y,obTimb.x,obTimb.y,obWall,1,0)"
Any help would be appreciated
STEP
"if collision_line(x,y,obTimb.x,obTimb.y,obWall,1,0)
{
move_snap(0,0)
}
else
{
mp_potential_step(obTimb.x,obTimb.y,4,1)
}"
Then this is the code on the player:
COLLISION WITH ENEMY
"hp -= 5
audio_play_sound(sndShooting,1,0)
if hp <= 0
{
global.gameEnd = true
obTimb.visible = false
room_goto(roomGameOver)
audio_play_sound(sndPlayerHit,1,0)
}"
I am getting an ERROR That looks like this whenever an enemy kills the player:
"FATAL ERROR in
action number 1
of Step Event0
for object obZomb:
Unable to find any instance for object index '0' name 'obTimb'
at gml_Object_obZomb_StepNormalEvent_1 (line 1) - if collision_line(x,y,obTimb.x,obTimb.y,obWall,1,0)"
Any help would be appreciated