Day 9, CoreProgramming-1

Pick up w/ negative affect to the player: Randomly spawn 2–4 Enemies @ random location.x

Finally, it’s the last section of the core programming within the 2d shooter course; although I feel that these last two sections take 70%+ of the time of the entire course.

To start off, I made, yet another pickup that negatively affects the player. The Purple pickup that notes EnemySpawn is a pick up that randomly chooses between value of 2 to 4 of the enemies and spawns them at random x value locations.
int EnemyCount = Random.Range(2, 4);
int i;
for (i = 0; i < EnemyCount; i++)
{…}
was used to randomly select the enemyCount and for the value, spawn the enemy. I had a challenge on this as I tried to implement this within the spawn manager. And it definitely made sense to, however I ended up adding the script within the player script with additional variables due to complications in getting all the components from powerup -> player -> Spawn Manager.

Stops Blinking after 10 laser + Max Laser Capped at 150

Another feature was the laser count. I have already implemented the Laser Counter previously however, I definitely needed more lasers if I want to add wave systems and boss into the game. Since the current Laser Counter had 15 bars, I increased the value of total Laser to 150 and capped it. Added the number display using the UI.Text for easier read. For every 10 lasers, the laser in the laser counter drops under 10 lasers, the laser counter blinks to notify the player. When the value of laser exceeds the 150 from the pickups, laser still maxes out at 150.

The challenges in this came as I use coroutine within the laser counter implementation. For every shot fired under 10, the blinking of the counter went faster and faster. I needed to set another variable that asked if the counter is already blinking. Then if blinking is already true, not start another coroutine of the blinking effect. I tried this within the ienumerator and found that I can’t use 2 parameters when using ‘while’. So I then tried to use if function within the while, and the unity kept crashing. So in the end, I have inputted requesting if blinking=false before starting coroutine within the UpdateLaserCount(). And the coroutine includes the update to blinking=true in order to not call another coroutine on top of it.

Tomorrow is the Thanksgiving. I hope everyone have a good thanksgiving.

--

--

--

Software Developer @ GameDevHQ

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Nodal basis function 1D

PancakeSwap’s Mobox Trading Battle with Prizes Worth Up to $80,000 with Tokens and NFTs!

Using constant pools to speed up your Elixir code

Rest Controller — Unit Testing

Introducing Webhooks on Forge — Forge

#freestockphoto (Saturday 14th 08AM)

Fake code with Pseudo code

Humans of DataHub: Hyejin Yoon

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ji Soo Ahn

Ji Soo Ahn

Software Developer @ GameDevHQ

More from Medium

Live Operations, Game Operations or Player Experience Management

How to Comission the Best Art for your Indie Game

How to Clean Cache in Android Phones?

Top 10 Game Developers On Fiverr of 2021 Hire Now!

multiplayer game, android game, unity game, game development, game reskin