What I Did:
Today I begun by making the player ship shoot the projectiles, to start this off I created a new empty game object and named is Shot Spawn. I then made it a child to the player ship. After that I reopened the player controller script to add some code to make the shots fire.
public float fireRate;
private float nextFire;
void Update ()
{
if (Input.GetButton("Fire1") && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
}
}
Moving on to the next tutorial I will be creating a boundary to destroy the shots that have moved off the screen. It will be a box that will also deal with the hazards that will be implemented into the game later. I first created a cube, naming it boundary, and scaled it to fit the cameras view. I then made it a trigger and attached a new script to it telling it to destroy every thing that leaves the cubes area.
What I Learned:
I learned a method of how to rapidly spawn and destroy objects as needed for a game.
What I'm Doing Next Day:
Next day I will be creating the first hazard for the space shooter game for the player to destroy.
No comments:
Post a Comment