Learn with tiles › 14
If
Do the tiles inside only when a condition is true.
1
Until now, every tile you placed always ran. Now let's make tiles run only sometimes.
The if (condition) then tile does the tiles inside it only when the condition is true. When it is not true, it just skips them.
The condition below is "x position > 100". It means "Lara's x position is greater than 100". Put a say tile inside the if tile.
To do Walk with the → key. When the x position becomes greater than 100, make Lara say I came far!.
Loading tiles…
2
You make a condition with a comparison tile. There are ( ) > ( ), ( ) < ( ) and ( ) == ( ).
>the left side is greater<the left side is smaller==both sides are the same
You do not drag value tiles from the drawer. You pick them in a slot. Tap the condition slot of the if tile (it holds true at first) and a small ▾ button appears next to it. Tap ▾ to see the value tiles that fit in that slot.
Put a comparison tile in the condition slot. Then, in the same way, put y position in the left slot of the comparison tile.
To do Lara goes up each time you tap her. After she goes up, if the y position is greater than 0, play the win sound.
Loading tiles…