brick breaker
controls
a and d
code
https://github.com/katpavan/brickbreaker
learned/notes
- run the game from the global scene
- that way the game manager game object will be present
- if you run the Level1 scene, the game manager game object won't be present
- in the Awake function of the Game Manager script
- I used sceneLoaded.
- It's a SystemAction (callback) in the SceneManager that we can attach a function to.
- In our case we're attaching OnLevelLoaded function from the Game Manager script to it.
- I use that to set the ball, paddle and bricks to whatever is in that particular scene
- In our case we're attaching OnLevelLoaded function from the Game Manager script to it.
- It's a SystemAction (callback) in the SceneManager that we can attach a function to.
- I used sceneLoaded.
In the OnLevelLoaded function. bricks is FindObjectsOfType and paddle or ball is FindObjectOfType. This is because bricks is plural/
ball = FindObjectOfType<Ball>();
paddle = FindObjectOfType<Paddle>();
bricks = FindObjectsOfType<Brick>();
- In the Game Manager script, we check if we cleared the board by checking if the brick is active in the scene hierarchy
- bricks[i].gameObject.activeInHierarchy
- this works because when we hit a brick in the Brick.cs file we set the brick to be inactive
- gameObject.SetActive(false);
- this works because when we hit a brick in the Brick.cs file we set the brick to be inactive
- bricks[i].gameObject.activeInHierarchy
- In the ResetPaddle function in Paddle.cs
- we set the x axis to 0 but we maintain the y axis position
- transform.position = new Vector2(0f, transform.position.y);
- we set the x axis to 0 but we maintain the y axis position
- froze the paddle on the y axis and froze the z rotation in the RigidBody2D constraints section.
- This way the paddle can only move left and right and not be spinning and won't move up and down.
- you add force to the rigidbody component
- use Invoke to delay code by some time
- look in Ball.cs
- made 2d physics material and put it on the ball
- 0 friction
- 0% friction
- 1 bouncy
- 100% bounciness
- 0 friction
- Bounce Reflection
- ball is going to bounce differently off the paddle based on where on the paddle it lands
- this is different from the pong game
- look in OnCollisionEnter2D function in the Paddle.cs file
- ball is going to bounce differently off the paddle based on where on the paddle it lands
idea
I think it'd be interesting if you were a falling ball in brick breaker and you have to clear all the numbered blocks
high numbered blocks make you bounce higher
it's almost like a puzzle game
I like the idea
research
I like how fast the blocks go down - it's intense
I like how this runs fast
wow this reminds me of puzzles and dragons but with brick breaker
as the ball bounces on blocks, it sends attacks at the creatures lol
interesting concept with pinball. boomers love pinball so maybe.
brick breaker as an idle game?
I don't get what's going on but I like it lol
I like how you earn currency in the levels and how there are bosses
something about seeing the numbers go down is cool. It's like space invaders and brick breaker together. the enemy blocks go down like the invaders
i like how when the ball bounces it makes a song
this could be an in between bonus game mode. it just feels and sounds satisfying
Leave a comment
Log in with itch.io to leave a comment.