Day 10
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.
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.
Get Frankie Rodriguez’s stories in your inbox
Join Medium for free to get updates from this writer.
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));
Power up those assets!







