🎄Merry Christmas🎄Coolest Christmas Gift Received Ever!
🌟All products' price reduced by 15% off
🎁Hot-Selling Items: Buy 10 Get 1 Free

Shot the Bull’s-eye in ecode (Ⅱ)

Following with the previous issue of Shot the Bull’s-eye in ecode (I), we would continue programming and enable it to achieve shooting and scoring functions. The principle is very simple, let’s do it together now! First, we need to add a code to the arrow and launch the arrow when the space bar is pressed.

When the space bar is pressed, another script is stopped (the script that moves the crosshair).

Game effect demonstration:

Shot the Bul eye

Test your program again. This time the crosshair should stop moving when the space bar is pressed.

Shot the Bul eye

Add some animation to the crosshair to make it look like it is constantly moving towards the target.

Shot the Bul eye

Test your game again. Now when you press the space bar, you should see the crosshair keeps getting smaller, as if it is moving towards the target.

Shot the Bul eye

Once the arrow hits the target, you can tell the player how many points they scored. For example, if you hit the blue bullseye, you can get 60 points.

Shot the Bul eye

Shot the Bul eye

Finally, we add the score of the corresponding color area, when you hit the different color area of the bullseye, you will get a score. At the end, we need to broadcast the new arrow message again to get a new arrow. In this way, arrows can be fired continuously to get different scores.

Shot the Bul eye

I can get up to 100 points. Come and test how many points you can get?

Shot the Bul eye

If you have any ideas or opinions, please feel free to contact us via [email protected].

Leave a Reply

Frame 422188
Meet ELECFREAKS at BETT 2025!
Frame 422521
Our New Distributor——BERRYBASE
images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
Frame 422188
Meet ELECFREAKS at BETT 2025!
Frame 422521
Our New Distributor——BERRYBASE
images
How to make a counter with micro:bit?
Monthly Archive