In this game you control the dog to get the ball. Once you get the ball, a man will be chasing you, you have to shoot it in the basketball hoop as soon as possible. If the man touches you three times, you will be game over. For the points you gain by shooting balls, you can buy skins, extra lives, and infinity balls from the shop.
Just click the link below to see and edit the sources code in Microsoft MakeCode Arcade
I created this game in 10 days when I first learnt MakeCode Arcade. This platform is really fun and easy to create a Arcade games you like, I will show you how to make this!
I will buy you lunch if you can score more than 1200.. 🙂
How does the program work?
Here is the monster movement control, I made the monster going down zig-zag. The monster moves to the right border, then go down one line and go back to the left border and go down. Repeat the movement until it touches the player or when it get shot.
I made a variable to check if the monster is killed or not. If the monster is not killed, it will continue the movement. When the monster is killed or hit the player, it will spawn somewhere in line 1 to 3.
I also give a point bonus, when the monster goes more downward, it will give more points to the player.
I made levels by using different variables , so that monster have different behavior at every level.
For level 2, I make the monster to shoot bullet.
For level 3, I make the monster become hard to hit by making it invisible and appear every step.
For this level definer, you need to set the variable to the number that you need for each level. For example of level 5,
‘Kill_Target’ is the number of monster you have to kill to advance to the next level
‘monster_invisible’ to tell whether the monster will be invisible or not.
Set ‘Alien’ to different monster type.
‘monster_type’ is how much score you get from hit the monster.
‘monster_delay_set’ the shorter you set it the faster the monster moves.
Before calling the function ‘playing’ to start the level manager, I also have to turn on the monster stay in screen or else it will bug the game and you will never see the monster.
I also reserved a function to change the background for each level, but I am too lazy to create the background and keep them all the same… XD
When press ‘A’ button, the spaceship will shoot a bullet up, i.e. -y is upside. If the bullet hits the monster, it will add points according to the ‘monster_type’ I defined in level definer as well as how low the monster go down. Then, make the variable ‘killed’ to one so that the function will do the monster reset in the level manager.
Attacked by Monster!
When the monster’s bullet hit the spaceship, you will minus a life. Then, will destroy the bullet, so that it will not double hit the spaceship.
When the monster hit the spaceship you will also minus a life and this time the monster will go back to the top at line 1-3. If it is level 8, the monster will go back at once, so that it will not double hit the spaceship.
If you got hit by the monster or shot by it 3 times you will game over.
My Second dream was ‘mice maze’, it was very popular when I was childhood, program a ‘mice’ to solve the maze automatically. Actually, my 25 years old final year project was ‘smart vacuum cleaner’, it is now very popular. But, it was very new concept at that time and I defined some ‘mice’ behavior. And now, I proof that it work based on Scratch.
Scratch, thanks a again!!
P.S. I like to stare the screen to see the mice to run the path. If you want to run it faster, hold shift when press the green flag.. 🙂
Basic idea for the mice’s logic
That’s a very basic and simple logic for the mice…. XD
We make the mice in a square with dimension same as the maze path, we are using 48pt x 48pt.
The mice is moving in a unit of it’s size, i.e. 48pt
We define the priority of the movement for the mice to follow,
Always go forward
Go right if cannot go forward
Go left if both forward and right are blocked
Move backward if no more movement.
Then, we need to record each movement and possible (not explore) directions.
When the mice move backward, it will read the record and go to un-explore directions.
How does the program work
Prior I created the mice maze, I actually made a program by using WASD key to move the mice, solve the maze manually. So, keep in mind, W – up, D – right, S – down, A – left, it is too hard for you if you are FPS game player.. LOL
Sensor – detecting wall
Before the ‘mice’ do any movement, it will detect any wall in it’s four directions. In this program, I move the ‘mice’ to four directions in a certain distance. See if it will hit a wall (black in color) or not. If not hit, W A S & D will be put into the corresponding variable Wall U, D, R & L, tell the ‘mice’ that the direction is OK to move. Otherwise, keep the variable as X, means there is a wall.
I am using a LIST called ‘Path’ to record each movement of the ‘mice’,
Scratch made Adam’s dream came, create a game… Since my childhood, I was expert in Assembly, i.e. 6502, x86, 8051, modifying OS and even created a mini Chinese display system. But, never created a single game.. I tried to make game with Assembly, it was painful even make a character moving.. Thanks Scratch!!