> Tutorial
You have seen that it is possible to manipulate numbers, but there are also special values: null and booleans.
null valuenull is a value representing an empty, invalid or even an error value, but it is different from the number 0.
For example, me.weapon returns the weapon your leek is holding, or null if you don't have a weapon in your hands.
You may have noticed that me.setWeapon() costs 1 TP per turn. It is possible to limit its use to turn 1 with this condition:
true and falseBooleans are two values: true and false. These are two values that can be used to represent something that can have two states like:
Examples of properties and methods that return a boolean:
enemy.alive returns true if the entity is alive, false otherwise.me.canUseWeapon(enemy) returns true if you can use your weapon on the enemy.Example: we check if we can use our weapon on the enemy:
What can null be used for?
Representing a lack of information/value Represent the number 0 Represent an error Representing a poor quality program
What are booleans for?
Represent a value with two possible states Represent a very high value
Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.