Small Updates
Small Updates
This morning I fooled around with some more of the gameplay mechanics over the leaderboard and really started to have some fun! First off I found it a bit too easy leaving the paw in the middle as you could get a lot of taps easy by just doing nothing and letting the ball continue to fall on the not moving paw. Therefore, I moved the paw to the left side to make the player tap and made the paw a bit quicker on tap. To then fill in the gap in the middle I added some eyes (where the cat face will eventually go) and applied a simple follow script to the eyes so they will always follow the ball. However, this script became more involved than I was expecting (see below).
public class EyeLookAt : MonoBehaviour { Transform ball; GameObject[] foundBalls; public float eyeSpeed; private void Awake() { foundBalls = GameObject.FindGameObjectsWithTag("Ball"); ball = foundBalls[0].transform; } private void FixedUpdate() { if (ball != null) { Vector3 dir = ball.position - transform.position; float angle = Mathf.Atan2(dir.y,dir.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward); transform.up = ball.transform.position - transform.position; } else { foundBalls = GameObject.FindGameObjectsWithTag("Ball"); if (foundBalls.Length > 0) { ball = foundBalls[0].transform; } else { transform.Rotate (0,0,50 * Time.deltaTime * eyeSpeed); } } } }
I really do not like using the `FindGameObject` functions, but I felt I optimized this script enough to only search for the balls on awake and when the original ball is destroyed. I then make the eyes spin in circles when the player loses all balls which is quite fun to see on the game over screen.
More Pawer Ups
After learning how to take advantage of the scriptable objects, I discovered how to scale this and use them to their full advantage. Because of the scriptable object framework I was able to add in just a few minutes a completely new Pawer Up that will decrease gravity for a short time... the Pawer Up is called "GraviKitty"! So far I now have two Pawer Ups that will drop at every tap that is divisible by 5. I will probably extend this out for real gameplay. These Pawer Ups though really add some fun variety to the game and I am looking forward to coming up with more ideas!