Day14, Better days

After days of struggling, I’ve finally come to senses and started pouring out additional features into the game. The first was putting in the balance work of the Pickups. In the probability of 100 (range 0–101[last number is exclusive]), first 50% spawns value of 0 and 1. which is extra enemy spawn and speed boost. the next 30% designated to 2, and 3 being laser refills, triple shot, and extra shields. The last 20% was designated to 4 and 5 with extra shielding and life.

After the script has been changed, I had to go ahead and change in the inspector and rearrange the powerups to its array. and also gave a change to the powerup script that defined the numbers. But for some reason, the prefab absorbed and the actual features weren’t matching. This gave me quite a headache until…

I realized I didn’t change the PowerupID of the powerup prefabs. Then it worked like a charm.

Aggressive Enemy and Enemy dealing with pickups were the other 2 implementation that was done today while enemy pickup is still in its way of modification. With the script similar to Enemy Evade from yesterday, the enemy script measured the distance between the player and and its own gameobject. And while player is not null, within the set distance, the enemy slams towards the player using movetowards function within the vector3. At first play of the game, I was surprised at how fast the enemy charged towards the player. I just had to reduce the speed a bit. What a pleasant surprise that was.

The Next was the Enemy attacking towards the pick ups. As enemy and pick ups are both randomized in its spawn, it’s rather rare that the pick up falls in front of the enemy. However, when the enemy is shooting the laser and the pick up happens to be in the front, tagged enemy laser, do destroy the gameobject of the pickup. However, I wanted the enemy to actually detect* the pickups and then shoot with a mind to destroy the gameobject. So that is still under its way with Raycast. I did have a use with the raycast with my 3d personal project when I wanted the object to know when it’s touching the terrain so that it doesn’t double jump in the air. So I thought this would be a good implementation in measuring to know if the gameobject is in front of the enemy.



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