For my first game prototype I was tasked in creating a series of effects and game mechanics involving cubes. I would start by using the duplication code for the cubes which I learnt in some of the first lessons and use this to program a specific alignment for said cubes. Over this post you shall see the cubes being used for stairs, forming bigger constructs, spawning multiples of another object as a projectile and creating art. ​​​​​​​
I first started with my older cube file, in unity I took pictures of the code and had it ready on my desktop to use for later documentation and referral. The "Spawncubes" code is featured below and involved making a cube then turning it into a prefab and putting it back in again over an empty object which would eventually spawn them in that location space.

Using the same cube prefab fil form last week.

making cubes spawn into stairs

Adding a float symbol to the X, Y, Z coordinates to make cubes turn into stairs

Staircase cubes and sphere

After putting in the code for the cubes X, Y and Z coordinates I was able to pair the code on the empty space and hit play. As you can see on the right, the cubes descended by one centimetre in the game space. I placed a sphere to show the middle of the scene and this would be used later to make more complicated shapes. I also added a float symbol to each of them which allowed it could contain a numbered value which would be stored in floating point code area in visual studios. So I could add a minus number and the cube would spawn below the Y axis. 
Next I was making code as shown below in comparison to my screen on the right and the lesson screen on the left for me to see what the example in the tutorial was supposed to turn out like. The code was to make the cubes stretch and form a large constructed shape.

Making the cubes stretch out and form a shape.

cubes look like Minecraft block

Atom cluster

Funny enough whilst I was making the code and seeing what the impact was in unity, the cubes all got stuck together in one place. To me this looked like in my mind like a Minecraft block, since the textures on the blocks in that game are different sizes and colours. And after that I did code to make even more appear in bigger sizes and this time make a spectral cluster shape, like atoms all bundled together.

even more blocky block 

cubes starting to appear after SpawnRandom code input

making a circle out of cubes

half a circle with 3 floats

And then finally the last string of code I used was with angles, positions and sin, cos and tan. I hadn't used sin, cos and tan since year 11 and did not have fun memories, but I did have fun making this code for the mini prototype level. This was to make sure that the cubes spawned in would follow each other in ascending or descending order. Just like the staircase, the cubes here would appear and disappear in a full circle shape and slowly smooth themselves out. On mine however, it did not make a full circle and only did half. But I'm sure that I probable missed one number or piece of code for this issue and I would probably fix this over the summer holiday for fun and catch up on coding tutorials for my second year.

Video showcasing cubes being spawned in and forming half a circle shape.

After making cubes spawn, and form specific shapes/patterns I thought it would be cool to see the cube spawn other objects from a birds eye view and so the next lesson along was just that. This last in-lesson tutorial involved the "spawnsphere" code to make them drop from a specific point and hit other tiles below to destroy the picture made. Basically it was like brick breaker or Atari Breakout where you use a slider and a spawner to shoot or drop a ball into a targeted wall which would slowly break over time. Each part of the wall had a different colour for variety or strength of said part, red being the hardest. Atari Breakout has a playable version on the google page and features different pictures to hit and destroy. 

Code to Spawn sphere, drop sphere and disappear

A screenshot of my code to make sphere fall and bounce when dropped 

 I used the spawnsphere code on a cube that would be moveable with the W,A,S,D keyboard keys and would drop a sphere with spacebar wherever  you moved it. This would then drop the sphere on a rotating planform that could make the balls bounce off or completely miss the targets below. The targets being tiles when hit once would disappear and the player would be able to concentrate on the harder or out of reach ones over time. 

The code to make the sphere "deleteself" after being spawned enough times.

The code to make the spheres dropped change colour using the "colourchange" script.

Whilst making and changing the code for the balls to bounce and change colour when spawned in to the prototype mini-game, I had some fun just playing around with the simple design below. I had tried this beforehand and wanted to test its potential with the new code I was writing at this point. I even took a video showcasing my attempt to make one or both balls bounce up and down as the platform below them was spinning. I wanted to get both to fall at the right moment so that they did not bounce off or roll/fall down. This was temporary however as I wanted to catch up with what I was happening in the lesson. To turn this into a game would be similar to brick breaker and would involve the balls being launched into a pinball esc area only to be flipped at the bottom by the rotating platform.

My initial attempt to make the balls bounce when dropped onto a rotating tile surface area. 

My inspiration from the Breakout arcade game.

                           My secondary bit of inspiration whilst I was making my tile breaker unity prototype level.
My initial thoughts when making the tile breaker prototype game was thinking about the fall guys "hex a gone" mini-game shown above and I tried to replicate that in the lesson that day. Not only were the colours similar but the feel and aesthetic was familiar too. The fact that when jumping on the falling hexagon platforms, they would change to a darker variation of it was notable too. And while messing around with the materials in unity, I tried to make it more of a moody playthrough than a simple looking & feeling one. As fall guys gameplay and its controls are suited for all ages, the colour scheme at first launch was mostly yellow, blue, pink and purple. (other than teams colours and picture match etc) So I wanted my version to have darker colours that set a darker mood.

Screenshot of Tile breaker mini-game with shooter and balls falling on tile clones.

Video showcasing my gameplay footage of playing and attempting to destroy all tiles in the Tile breaker Mini-game prototype.

Back to Top