Second day in this personal challenge and second game made! In the morning of day2, I had a weird bug when I tried to build the webplayer. It took a while to debug and I started this second game kinda late. Considering this, I’m pretty happy with the results even if I hoped to add more feature! It seems that someone liked how you controlled the ship in Day1’s game, 3DRunner, because they decided to give you a robot-miner for today’s game. Make good use of it and gather lots of cash, it might come useful for Day3’s game!
Day 2 – DigDeep
I wanted to make some kind of 2D miner game. Along the way, the project started to look like an old classic, Motherload.
How I did it :
I started this project by creating a class for GroundGeneration. When the scene is loaded, an array is filled with number representing the type of tile to be displayed. The map is then iterated to create all sprite one by one in the scene. Each sprite has its one GameObject for now. It would have been more efficient to create Chunk that contains many sprites. However, for rapid prototyping sake, I took the first option and I’m glad I did. The detection/destruction of each tile has been really simple to implement. When the player is moving in a direction, Physics2D.OverlapCircle() is created in the player’s moving direction. If it collide with a tile, the tile is destroyed and added to the player inventory.
Lesson learned :
- I’m starting to have a good grasp of Unity2D workflow. I haven’t used 2dCollided and Collision2D a lot so I learn that on the way.
- This was the first time I created procedurally generated content for 2D. The instantiation of sprite was a bit tricky at first but everything came along nicely.
What’s Left :
I would have like to add the option to buy upgrade for the miner in the shop. I also wanted to be able to buy new, bigger and more valuable land from the shop . Lastly, I wanted to use animation for the player’s miner but I haven’t took the time to do it. There is just so much you can do in a 10h period!
The coding of this second game went pretty well. It took more time than I thought to setup the world generation but it went fine. I’m getting a good idea on how I want to start and structure my projects as I’m starting project over and over. I already have day3 game setup in my mind. I’ll get to it right now because it will be pretty UI-Heavy, and interface is a good place to lose a lot of time.