So today we started coding for a little game to help with out group project just to help us with a few things that may also be in our games or will come in handy.
So first we made a script called ship control just to make it move for now.
Then we made a Sphere and a new material naming both Enemy and Enemy Mat, we then applied the Enemy Mat which we made the colour red to the Enemy sphere.
Added rigid body, un-tick gravity and tick
kinematic.
Add a script onto enemy and call it
EnemyMotion.
Make a new empty object and call it manager
and make a new script called manager.
Then go back to enemy script to make the Enemy basically follow the player.
(In game)
We then went back to the Shop Controller script and added a bit of code which then allows the shop to face where the mouse is pointing at. The vector
3 positon for the y value is 2 because the ship is at the y value of 2 and we
want to keep it there.
Make a new object (cube) scale it down and
thin and name it bullet, also make a new mat
and make it yellow and apply it to the bullet. Make new script called
BulletMotion.
Make a bullet spawn and call it that.
Then remove everything from it except the
transform and then drag it into the player so it follows the player around
Add a script to it called BulletFire.
This script then allow it to fire bullets.
Make a prefab called Bullet
Then drag the bullet from the left to the
bullet prefab and the bullet on the left will turn blue which means prefab
Then
you can drag the bullet prefab into the bulletspawn script.
And delete the bullet on the left.
No comments:
Post a Comment