Purpose
On the basis of the aircraft battle project in last week, I would like to upgrade the “bullets” to strengthen its power by collecting the bullets left by enemies.
The initial version of the aircraft battle: https://www.elecfreaks.com/blog/post/aircrafts-battle.html
Preparation
Program
Go to MakeCode Arcade: https://arcade.makecode.com/
Code
Revise the code in the former project: https://makecode.com/_UE2Xbt9FyV8E
Set with possibilities for the enemies to leave their unused bullets after they are attacked. Set a random value of Drop probability from 0~100 after the enemies are attacked, judge if the value is 1, if yes, generate a projectile Bullet upgrade package at the place of the enemies and set its type as 1, and define the speed from X&Y; set Drop probability bounce on wall.
Define the code of the package, if the Player sprite coincides with the 1 type sprite, upgrade the bullets and degrade it to 1 type sprite.
If the enemy type sprite coincides with 1 type sprite, set to destroy the 1 type sprite.
Program with different bullets level.
Link: https://makecode.com/_5PhT09YCK0Wa
Downloading
After programming, connect the computer with the Retro via the USB cable.
Choose hardware “F4”.
Click the reset button on the Retro and go to the downloading page.
Match the devices and get connected with “Arcade”.
Click downloading to compile the program into the Retro.
Conclusion
Control the movement of the spirit in the screen, set the life in 3. When it crashes onto the enemy, the life score decreases 1, the game is over when the score is 0; press button A to launch the projectiles, the score adds 1 each time when the enemy gets hit. After attacking the enemies down, set the possibilities to collect the bullets that move at random, if the enemies pick up them, the bullets get destroyed; if the aircraft picks up the bullets package, it upgrades the bullets package automatically with the highest bullet level in 3.