Day 10

Frankie Rodriguez
2 min readNov 21, 2020

--

Cr: hack coding gif by Matthew Butler via Giphy

Today’s focus was on developing my game. As you read in my last post, I started to develop the triple shot power up. Today I finalized the process. Though it’s been a lot of work — literally it’s been: eat sleep, code; I feel really good that my game project is coming along.

Animate the Triple Shot Powerup: Firstly, go to Windows, scroll down and click ‘animation’. A window will pop up that I then docked next to the console. Within the animation window, I created an animator and an animation. I then selected the gameObject I wanted to create an animation for in the hierarchy. On the animation window, I clicked the record button. Then I went to the Triple Shot sprite folder, selected all the power up sprites and dragged them into the animation recording area.

Example of Animator window via Unity

Spawning Routine for Triple Shot: First I created an IEnumeratorSpawnPowerupRoutine() followed by a while(_stopSpawning==false). Setting it to false will auto clean once the player dies. Next I needed to define the random spawn for triple shot within the while() loop {}, i.e.

To spawn in the power up, create a private GameObject_tripleShotPowerupPrefab; — Once that’s been created Instantiate the gameObject at a random post. Since I am not too concerned with rotation, set the gameObject to Quaternion.identity. The complete code will look like this.

Instantiate(_tripleShotPowerUpPrefab, postToSpawn, Quaternion.identitiy);

I then went on to ensure the power up spawn within x–y amount of seconds. To do that, I created a yield within the while() loop which will then look like this:

yieldreturnnewWaitForSeconds(Random.Range(X,Y));

Cr: Angry Dungeons And Dragons GIF By Hyper RPG via Giphy

Power up those assets!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Frankie Rodriguez
Frankie Rodriguez

No responses yet

Write a response