Coin Flipper

Step 1

Place a on button pressed block to run code when button A is pressed.

Step 2

Place a if block and check the value returned by the pick random true or false block. pick random true or false returns true or false randomly.

Step 3

Place a show icon block under the if and pick one of the images.

Step 4

Click Download to transfer your code in your micro:bit and press button A to try it out.

Step 5

Place multiple show icon blocks before the if to create a coin flipping animation.

Step 6

Click Download to transfer your code in your micro:bit and press button A to try it out! Link of the whole program: https://makecode.microbit.org/_0o73M1Ldw9ka

This article comes from Coin Flipper.