Some tutorials to allow you to manipulate water in your Project Spark world design.
The water table
The water in your world is controlled in the World Properties menu. You can turn water on or off. You can change the water type (such as Clear Calm A, Arctic Water,Desert Water)
You can change the water level (between -80 and 560) default is 9.05
All the rivers, seas, lakes you create in your world will be at the same water level height. You cannot have rivers on top of mountains, or on floating islands. You can however change the water level during the game.
WHEN [Once] DO [world water level][=]
Gradual water rise
Your character is trapped in a room and water is coming in. Can he find the lever to open the door and escape before he is drowned?
To get a gradual water rise create a variable that represents the water and gradually increase it.
WHEN [countdown timer][0.5][loop] DO [numvar:water][increment by][0.1]
WHEN DO [numvar:water][=][clamp][numvar:water][max][min]
WHEN DO [world water level][=][numvar:water]
Every half a second the water will rise by 0.1 of a meter until it reaches 17 meters. You can change these numbers to suit your game.
To kill your character when the room is full of water add something like
…WHEN [countdown timer] DO [kill][IWP:your player]
Apart from the options in World Properties for water type (desert, alien asteroid) water cannot be coloured in kode. You can experiment with lightbulbs, but they will colour everything, not just the water. There is no option to change the water type in kode either.
Water effects can be coloured though. Only in the brain properties, not by kode. Change the waterfall effect to red for example for lava, or a fountain of blood. The floating water pool only has the same colouring options as the main water.
Detecting if in the water
The only kode that detects if an object is in the water is [swimming]. Unfortunately this only works with objects set to Character physics , and they must be floating, so heavy objects that are in water wont set it off.
WHEN [swimming] DO
Another option is to use a trigger zone. Trigger zones on Logic cubes are a maximum of 20x the size of the logic cube, and are cubes. Not very useful for rivers or coastlines, but might work okay for a lake.
WHEN [in trigger zone][IWP:your object] DO