Flip a hidden switch after moving an object

I would like to create a simple puzzle in which when the character is near the washing machine and presses the Z button the washing machine moves to position X -4600 and after the washing machine has moved I can activate the switch with the Z button with its due animation.
But when I go to move the washing machine the switch also activates instead I would like to move the washing machine first and then activate the switch.
Maybe with examples.

can you screen snip the code that moves the washing machine and activates the switch?

No need for Any snips @MrMen i got this
So @Joe84 The answer to your question is here:


NOTE:I left out the pixels blank so you can put the value of your own choice.
And Your Welcome

There are multiple ways to achieve the same outcome. Screen snips allow a suitable answer to be given.

The solution you’ve given is fine if the player can’t walk in front of the washing machine object. But if they can stand in front of both the washing machine and light switch, then both will be activated.

After the switch finishes the animation a door should open.

Exactly and it is exactly what is needed to avoid activating both but only one at a time, first move the washing machine then with the same Z button activate the switch which in turn will open a door with which the character can interact. :grinning:

Yes you are right i didnt mean to mind you so if i did offense you then im sorry if you mind

It’ll take load more to offend me, so no worries there.


Here’s how I’ve done it in my current game. It’s hidden object style scene, where symbols are hidden behind objects in the scenery (which are all in an object group named clickable)

The normal object (in your case the washing machine) has a number of boolean variables:

  • hasBeenClicked, which is set to true once the object has been clicked and actioned/moved
  • onClick is a structure, and has a number of children. One is unhideSymbol to indicate that it is covering a hidden object. This had to be done because I use the YSort extension, and it’d show the hidden symbol above the object hiding it.

The hidden symbol (the light switch in your case) also has a boolean flag on it (canBeClicked), to indicate it can clicked and actioned and is set once the covering object has been dealt with.

1 Like

Okay friend I’ll try with this scheme another question I created a button that once pressed by the character changes the animation of the flashing red spotlight making it green with a sound set to channel 1 once this is done when I go to click on the the blue button still sounds, however it should only sound when the spotlight animation is activated and not when it is activated.

I would suggest adding a condition to check that “Attivazione animation = 0” to this event:

image

1 Like