

objenemy.hp Two things can happen: If there is one instance currently active in the game, then that instance's variable will be referenced.
When you do:Actually the this.id part is completely invalid, unless you define this as an instance variable before that code runs. 1 Answer Sorted by: 0 The reason this is happening is because you are using the object index, and not an index of a specific instance. To reference the instance outside the with statement we use other(in this example, other will be the player).Īnd for the code in the enemy object, you don't have to use instance_find at all. From the list on the left, double-click on the baddie1 object.

In my player object: if (sprite_index = spr_player_attack_left) ". You can click the right mouse button on any of the parent events to open the following menu of options: Here you can choose two Open the parent event to inspect the code, or you can choose to Inherit the event or Override the event. Destroy Instance action to the Animation End event and make sure self is selected. I need to be able to destroy a specific instance of my enemy object without using the collision event. I've just started using gamemaker studio 2 and I've been scratching my head over this one for a while.
