top of page

Unity Introduction

Writer's picture: Deano SmithDeano Smith

The first thing we did was create a new project using the version 2019.4.8f1. When it downloaded we went to the asset store and downloaded Playground to get everything we need to create our 2D game.

To begin with, using the playground kit, we chose a background for the game. I chose a space theme starry scene and I set the sorting layer to Background, so everything else added will be in front of it.

I then chose a spaceship for the game, there were 2 options a blue or red, I picked red, I dragged it into the hierarchy so that it gets placed right in the middle of the screen. I changed the gravity scale to 0 so that it doesn't move on its own when the game begins.

After, in the Scripts folder I dragged the Push movement onto the Spaceship in the hierarchy, so when I play the game I can press the space bar to move forwards. Not only that, I also added the rotate movement from the same script folder.

Unfortunately the camera doesn't move along with the spaceship, so I have to add a script called camera follow to the main camera in the hierarchy.

Now I need to add an asteroid from the images file and add collision to both the spaceship and the asteroid say that they can interact with each other

.I then added a flame to the bottom of the spaceship to make it look more realistic and has some actual movement to the spaceship. I dragged the asset of the flame from the hierarchy into the spaceship one so that it connects to it.

I then added, from the attributes folder, a modify health script to the asteroid so that when I ad shooting to my spaceship it will damage the asteroid.

Now I added a user interface from the Prefabs tab so the player will know more of what is happening in the game. (Health, Score)

I even added a health system to the spaceship so if it gets hit by the asteroid it will lose health and when all the health is gone the game will end.

I added in a medium laser on to the hierarchy, and changed the gravity to 0, I then added in the Bullet attribute to the medium laser so it acts like a spaceship gun.

I then dragged the asset for the laser into the prefab ad deleted it from the hierarchy. I then created an empty asset which I gave the object shooter to and put the on the side of the spaceship, then duplicated it and put it on the other side.

That's pretty much all of it. Unfortunately I can't see the lasers when I shoot, but they still work as the asteroid moves when I aim at it and press the fire button.

0 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post
  • Facebook
  • Twitter
  • LinkedIn

©2020 by Dean Smith NEXTGEN Year 2. Proudly created with Wix.com

bottom of page