Hi there. It is day 3 of my 74 day challenge to become a Unity game developer. And today was a FUN day. I got started on creating my first 2D game!
I’d like to present to you:
A Cube. Or as I like to call him, Cubie. Impressive, I know. Cubie doesn’t seem like much now but don’t underestimate him. He will slowly transform into the main player of the game that I’m building.
I started by setting up his player position, learning how to make him move, first automatically then by user input, and finally setting up player bounds. I also learned how to give him a cool wrap feature.
And then there were lasers!
First thing I needed to do was learn how to create and instantiate the laser prefab. After that I learned about how the behavior works. One interesting thing is that the Update() in Unity is usually called at around a whopping 50 frames per second! This was affecting how fast the laser was shooting. Needless to say our good friend Cubie was feeling a little trigger happy at first. I learned how to use Time.deltaTime to normalize its speed. In this part of the course I also learned how to limit the amount of times fired within a timeframe, how to destroy laser objects for clean up, and how to have it project from a specific position.
Here are a few other things I learned today:
- It’s good to set your aspect ratio early.
- 1 Unit in Unity is = 1 meter in the real world.
- The Inspector value overrides the script.
Here are some challenges that I faced today:
- May need to figure out a way to speed up my computer. Things are running slow and at times it causes weird errors like the ones below that only happen some of the time.
Tomorrow I will be creating my enemies!
Until then.