"It’s Here! The BFCM Sale of the Year – Grab Your Favorites!"

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

images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
images
Children’s Programming Education is the Future Trend
images
Technical verification! Nezha series products can complete WRO competition tasks
images
Let's take part in the Ceremony of the New Factory of ELECFREAKS together!
images
Bluetooth Bee(HC-05 and HC-06) User Guide
images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
Monthly Archive