My Block Breaker Space Edition

Here my humble take on this classic. It has:
-5 levels
-Pause function
-A Lives system
-Lives Pickups coming from randomly selected bricks when destroyed
-Upgraded the controls so the mouse doesn’t have to be within the game screen to control the paddle
-An intro screen for each level announcing the level number
-An unbreakable brick
-Upper corners to keep the ball from getting into an endless loop
-Different sound effects for different bricks damage levels and for the unbreakable brick

I am 100% new to coding and Unity but both following the course and finding my way with the extra bits have been real fun (and useful). I hope you enjoy it! :slight_smile:

Here the link:
http://gamebucket.io/game/88f37237-1d29-43de-bd36-1857bccc63ef

Hey, I think you made well done job. I like the simplicity on your game its quite hard though
:smiley: I couldnt make it much.

My advice: You can adjust the whole audio source volume up and generally
I really liked randomly coming lives, upgraded controls for the mouse and want to learn how you did it

Hi Hsgngr.
Thanks for the feedback.

My process for the lives was like this:

  1. Create a variable (v1) containing a list of the breakable objects in your scene. A way to do it could be to tag those objects and use the tag to identify them (using e.g. GameObject.FindGameObjectsWithTag (“Breakable”))

  2. Identify how many breakable objects you have and assign that to another variable (v2).

  3. Create a list (list1) where each position contains a consecutive number from 0 to v2-1. Those numbers will represent the list indexes of the breakable objects in v1. You will use this list to refer to the objects in v1 later.

  4. Create an empty array (array) of length equal to your chosen maximum number of possible life pickups. You can assign a random value to that if you want.

  5. Then assign to each position of array (I used a “for” loop for that with and “i” variable increasing by 1 on each cycle) a random element from your list1.
    5.1 To do this, for each cycle of the “for” loop i created a new variable (v3) equal to a random number (use “Random.Range”) between 0 and the number of elements in list1 (I used “list1.count” to identify the number of elements).
    5.2 Then I assigned the “i” element of my array a value equal to the element in position v3 of my list1.
    5.3 Finally, I removed the element in position v3 from my list1 using “list1.RemoveAt (v3)” to avoid that an element would be selected randomly more than once.

  • Now, on your Brick script you can add that on collision with the ball it will run a “for” loop checking if “this.gameObject” is equal to one of the objects in your v1 list.
  1. If the condition in step 6 is true then use “Object.Instantiate” to instantiate an instance of your lifepickup prefab. Done

Hi Ruben,

There are a lot of great features here.

I like the longer Paddle and it’s texture, good particle effects and the extra lives.

Keep it up

Well Done :+1:

Thanks Wesley!

Privacy & Terms