Day 7 — Power ups and collectibles
Power ups and collectibles are something you see in a lot of different games. Many wonder how they’re made and how they work, they aren’t as complicated as you think.
Overall a power up or collectible is exactly that — “Run” into it and collect it. How does one go about doing that? Using Triggers. Unity has a component on a gameobject called a Collider which allows for Surface collisions aka run into a wall kind of collision. A trigger is another type of collision where you pass through and “collect” said object.
So as you can see here, the powerup moved down and once it ran into the player it was “collected” giving the Player the Triple Shot powerup.
Tag the Triple shot power up gameobject with “TripleShot” and allow for it to “enter” the player. Upon collection turn a boolean to true to allow the triple shot effect then do a Coroutine for a simple cooldown on it.
Going through this again has been pretty fun. Hopefully I can expand upon this more and more as I progress farther into it. With that though, it’s on to the next. The 2nd power up and getting them into the spawn manager.