Unity3D - Block Breaker
Semester IV: Behavioral Modelling - Assignment 1
Block Breaker
Menu Screen
The Block Breaker Tutorial is based on the popular Atari arcade game, Breakout. In Breakout, a layer of bricks lines the top third of the screen and the goal is to destroy them all. A ball moves straight around the screen, bouncing off the top and two sides of the screen. When a brick is hit, the ball bounces back and the brick is destroyed. The player loses a turn when the ball touches the bottom of the screen; to prevent this from happening, the player has a horizontally movable paddle to bounce the ball upward, keeping it in play.
Level 1 Design
Experience with C# Programming
Obviously my first time programming something out of nothing, game scripting was my scope of interest so I took it bravery as blindly. I'm not gonna talk all the script in the game but here are some few example:
- Block.cs
- Ball.cs
- Paddle.cs
- Gamestatus.cs
1. Block.cs
The script is used for detected whether the block is breakable or stationary when interacted with Ball. It also can the sprite when hit if only hit once or multiple times. This also calculated scores for the level as well.
2. Ball.cs
The most important part of the script is the ball itself (don't forget the paddle). The ball has it's own physics so have mercy please. Setting for the right speed was not easy cause I prefer slower and relax gameplay but I just suck at these kinds of game.
The Ball script is linked the Block which get hit by it and Paddle that launch and bounce it. Launching from the paddle when the player click it and bounce back when get hit by the block and paddle. Very simple Concept gamplay.
3. Paddle.cs
The Paddle's Job is simple, just shoot and bounce the ball back again. Thus, the script is shorter. It only needs to detect the mouse input and move accordingly to the correct position. Obviously it doesn't work all the time because it's determined by your screen size, else the control and speed doesn't felt consistent. So it also take the player display screen into consideration so the mouse input don't feel off.
4. Gamestatus.cs
As the name suggested, it is the status of the game running whether it's updating the scores or saying that you lose which load you to the Menu or quit.
Final Thoughts
There are more script that need to run the entire game by I'm only gonna discuss some cause this is very small and simple as the game's genre is very old with 2D graphics. Pretty good time killer and easy for beginner level. I will update my second assignment in the next post.
Comments
Post a Comment