Feed Animals Prototype
Controls: W/D or Left/Right Arrow keys to move left or right. [SPACE] to fire bananas
Purpose of Feed Animals Prototype:
- Write a script that allows users to move left / right, between two points
- Allow users to fire out an object if button is pressed
- When object collides with animal, both object and animal should disappear
- Spawn random animals at random locations (across same axis) at a fixed interval, and have them move forward
Methodology:
- C# Scripting in Visual Studio:
- Use an If Statement and transform.position to restrict the player between two points on the x axis
- Use Instantiate and Input.GetKey down to spawn the food
- Use InvokeRepeating to spawn animals at a fixed interval
- Create an Array that stores 3 different animals
- Call on an animal randomly from the array and spawn them at a random point on the x axis with Instantiate
- Use Destroy and an If Statement to destroy objects / animals that exit the screen
- Use Detect Collisions to detect when an object collides with an animal and destroy them both
- Unity
- Add Colliders to animals / food to detect collisions
- Create Prefabs for animals / food that will be reused often
- Create a SpawnManager that houses the array of animals
Plans for future improvement:
- Increase the vertical resolution to allow players to see animals earlier
- Decrease the speed of the chicken
- Create a cool down period between food launches
- Add particle effects when the food collides with the animal
- Start an animation when the player launches the food
- Player death when animal collides with player
- Allow the player to hit a powerup that will allow him to
- Get a speed boost
- Fire projectiles at a quicker rate
Leave a comment
Log in with itch.io to leave a comment.