My Object’s Instance Variable isn't working

My head is mashed with this one.
I’ve searched the forum and watched a video but still not quite getting this - sorry, I’m a noob.

I have a goulCount scene var. When a enemy dies… goulCount -1. I have Tiled Sprite for walls… but one particular is a secret door (highlighted in yellow square).

What am I doing wrong?

I’ve tried wall.variable(door) & wall.variableString(door) :frowning:

The delete only works on an object (in your case, for example, it’d be wall). You cannot delete an object’s variables.

If you wish to delete the wall with a specific door value, then you need to put this in the condition, under the goulCount variable condition. To do this, click on “Add condition” (under the goulCount condition), select the wall object, then select “Object variable value” option. You should then have “door” as an option in the drop down list.

1 Like

Sorry @MrMen, I’m really struggling to comprehend this :frowning_face:

I was getting nowhere, so I added an object var into the wall. Which wasn’t there yesterday.


Screenshot from 2025-05-30 16-38-09

My brain is scrambled eggs right now.

This:

is just comparing a wall’s door variable with itself. What you want is to identify the wall section that is a hidden door.

Try this instead:

  1. Rename the wall object variable “door” to “isHiddenDoor” (to better describe it’s usage).
  2. Change the type of isHiddenDoor to Boolean, and default it to false.
  3. In the scene editor, click on the hidden door, and in the properties panel change the isHiddenDoor value to true.
  4. In the event I snipped above, change the condition to “The variable isHiddenDoor of wall is true”.

BTW, instead of keeping track of the number of ghouls in the scene using a variable, you can use the object scene instance count to check on how many ghouls are in the scene. So your event becomes:

image

This should now open the hidden door once the number of ghouls is 0.

You can modify existing object variables but creating instance variables doesn’t seem to work. The variable needs to be created with the tab not the plus button in the instance variable section.


Thank you soo much @MrMen. That did the trick.
Thank you @Keith_1357 for you help also :slight_smile:

1 Like