We now add the main character in our game, which is the little alien named Space Buddy. To add the alien, we do the following:
- Download the
alien.png image from the following URL:
- Move it to the sprites folder.
- Create a sprite GameObject using the following image:
- Name the GameObject
- Go to Add Component | Physics 2D | Rigidbody 2D.
- Go to Add Component | Physics 2D | Box Collider 2D.
- Go to Add Component | New Script and name the script
- In the Project Browser, add a folder named
Scripts and move
SpaceBuddy.js into it.
- Add the following code to the script: