Make a platform move when you want it too.
First we need to set up the platform.
- Give an Asset the 'Basic Platform' Behaviour.
- Give the same Asset the 'Toggle Behaviour' Component.
Toggle Behaviour allows us to switch off the Assets Behaviour until we send a message to turn it on.
- Under the 'Toggle Behaviour' component settings give the 'Turn ON Message' a message. In this example we used 'platformOn' as our message.
- Set the 'initial Behaviour State' to 'False'
Now the platform will start the game switched off and will wait for a message 'platformOn' before it moves.
Now that our platform is set up we need a way to send it a message and there a couple of ways to do this. first example will be how to make the platform move when the Player pushes a button.
- Place down an Asset and give it the 'Button' Behaviour
- In the settings of the Button Behaviour, under 'Message to Send' put the message we set on the platforms Toggle Behaviour Component. In this example is was 'platformOn'
Now when the Player pushes the button the platform turns on.
In the next example we will show you how to make the platform move when a player reach a certain area.
- Place down any Asset, we going to make this Asset 'invisible' and 'No Collisions' and will be used to detect the Avatar to trigger the platform.
- Remove any 'Behaviours' on the Asset and give it the 'Speaker Component'
- In the settings of the 'Speaker Component' remove any text in the 'Text to display' field.
- Set the 'Display condition' to 'DetectEntity'
- Set the 'Message When Spoken' field to the 'platformOn' message.
Make sure the Detection Range is not to small. 3 is a good size for most cases.
That's it! Now when the Avatar walks in the range of the invisible object it will send a message that turns on the platform. You can do the same for killing another Asset or collecting an object.