1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 [solved] problem with player death

Discussion in 'Programming' started by woods, May 18, 2019 at 3:52 AM.

  1. woods

    woods Member

    Joined:
    Jun 21, 2016
    Posts:
    123
    making a simple game where player is fighting a dragon with an axe... am having an issue when the player dies...

    i get this error on player death..

    Unable to find any instance for object index '4' name 'obj_player'
    at gml_Object_obj_dragon_1_StepNormalEvent_1 (line 5) - image_angle = point_direction(x, y,obj_player.x, obj_player.y);
    ############################################################################################
    --------------------------------------------------------------------------------------------
    stack frame is
    gml_Object_obj_dragon_1_StepNormalEvent_1 (line 5)



    obj_dragon_1 step event
    Code:
    
    {
    image_angle = point_direction(x, y,obj_player.x, obj_player.y);
    }
    
    how do i deal with player death?

    edit....
    adding if instance_exists(obj_player) fixed the issue ;o)
     
  2. Cdiddysir

    Cdiddysir Member

    Joined:
    Feb 17, 2019
    Posts:
    43
    put this:

    "if instance_exists(obj_player)"

    above your code and it should work.
     
  3. woods

    woods Member

    Joined:
    Jun 21, 2016
    Posts:
    123
    hahaha i figured this out literally moments of posting my issue ;o) thank you sir
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice