K
Kenkech
Guest
Good day!
I am currently making my 1st game project via GameMaker Studio and I have some troubles with GameOver.
In the game there are enemies who create projectiles with "instance_create(x,y,obj_enemy_projectile)"
In projectile create event there is "move_towards_point(obj_player.x,obj_player.y,8)" so that bullets from enemy go to the player possition
When HP of the player reaches 0 and the GameOver event should normaly started the game gives an error which is adressing obj_player.x and obj_player.y but they do not longer exist(which is why an error occured) cause when player.HP reaches 0 I use instance_destroy() on the player.
I tryed to add player.hp>0 function to the enemy fire requirements so that it stoped fire after player is dead but it just caused error after gameover which couldn't fint player.HP (again cause of instance_destroy() on the player)
Please advice how could I bypass this problem and just have my normal restart page which was working fine before I have added enemy fire with "move_towards_point(obj_player.x,obj_player.y,8)"
Attached pic of code I use for playerDeath, enemyShoot and projectile props to aim player
Thanks in advance!!
I am currently making my 1st game project via GameMaker Studio and I have some troubles with GameOver.
In the game there are enemies who create projectiles with "instance_create(x,y,obj_enemy_projectile)"
In projectile create event there is "move_towards_point(obj_player.x,obj_player.y,8)" so that bullets from enemy go to the player possition
When HP of the player reaches 0 and the GameOver event should normaly started the game gives an error which is adressing obj_player.x and obj_player.y but they do not longer exist(which is why an error occured) cause when player.HP reaches 0 I use instance_destroy() on the player.
I tryed to add player.hp>0 function to the enemy fire requirements so that it stoped fire after player is dead but it just caused error after gameover which couldn't fint player.HP (again cause of instance_destroy() on the player)
Please advice how could I bypass this problem and just have my normal restart page which was working fine before I have added enemy fire with "move_towards_point(obj_player.x,obj_player.y,8)"
Attached pic of code I use for playerDeath, enemyShoot and projectile props to aim player
Thanks in advance!!
Attachments
-
353.7 KB Views: 3