Posts

FINDING DORY

Image
In this activity, we'll create a simple game applying all the previous lessons we've had in learning Unity. This will be a three (3) level game with simple obstacles on the course. 1. Create four (4) scenes. We have the Main Menu, Games 1, 2, 3, and 4. 2. Build the scenes in order. File -> Build Settings. 3. Design the Main Menu. We'll be needing 4 Buttons (Game1, Game2, Game3, Reset). Like this one. 4. Create an empty scene. Name it as MainMenuControl. The code is as follows and add the script to the scene. Assign button values. 5. Design each level scene however you like. For each level, we need to create an Level Control Scene ( Level Control Script) , 3 UI Texts - LevelNumber (Level Number Script) , YouWinText, and GameOverText. 6. Do the same for the remaining scenes. You can make a prefab of the same components you will use each scene so you won't have to repeat the process over again. 7. Have fun creating your game.

CATCH THE CRAB

Image
  In this blog, we will try to create a simple point and shoot game. We will be needing the following assets: First, place the crosshair and player in the main game scene. Design the game according to your choice. Since we will use the crab as our enemy, we will use a beach background. Make a script and copy the code below. In this example, we named the script PointAndShoot. Add this as a script component of the Main Camera . For creating the projectile/bullet prefab, drag the asset to the scene panel. Add Rigidbody2D and Circle Collider 2D as a component. Drag it back to the asset panel and you'll see the prefab of the projectile is created. The left crab is the regular asset, the right crab is the prefab asset. Do the same for the web/bullet asset. Create an empty scene and name it as PlayerHolder. Make the player as a child and add another empty scene named bulletStart. Place the bulletStart just right into the player canon. This is where the web/bullet will come from.  Now, ass

SIMPLE MAZE GAME

Image
  Now that we have learned most of the basics of using Unity, we will try to apply these concepts and make a simple maze game. Layout your desired maze design. It should have a player, enemies, hearts, two canvas texts containing "GAME OVER" and "SAVE", and a life display at the upper center. Example below. Now for the scripts: PLAYER. Player Script and Life Script. Player Script Life Script ENEMIES. Assign positions for the movement of the enemies in the game. Done previously in this lesson . Refer to the robber movement. HEARTS. Create a parent for the hearts. This is where we will add the Life Counter Script. 6 hearts. 3 for the actual maze. another 3 for the life display. Life Counter Script And we're done. Just make sure to assign all Game Objects to its corresponding variables (look at the Inspector Panel) to make the script function accordingly. The game should look like this.

COIN GAME

Image
In the previous lessons, we have learned how to add, move, and rotate an object in Unity. We will now apply these concepts to create a simple game; COIN COUNTER GAME. We need to import assets such as a ball (player), coin, robber (antagonist/challenge). After import, place the assets as shown. Note that the robber's initial position must be out of the main scene. ADDING SCORE TEXT We want to display the players score in the game. In order to do that, we go to the Scene Panel , right click, select UI , and finally select Text . A scene will be created named Canvas.  Click  Text  under it, and from the Inspector Panel, write Score: as the text. Also, align the text in the upper center position of the canvas. ADDING COMPONENTS FOR EACH ASSET For the Score Text, we will add a script component containing the following code: Make sure to add UnityEngine.UI  library in your code since we are using a UI Component in the scene. For the ball, we will add a script component for its controls -

HOW TO MAKE AN OBJECT MOVE AND ROTATE IN UNITY

Image
In the previous lesson, we have learned the basics of unity. From getting familiar with unity tools, importing assets, and how to make the assets have its own components and scripts. If you haven't tried that out yet, you may visit it here: How to add and make an object move in Unity Today's activity, we'll be needing three assets: ball, stick, and boxes. After importing the assets, position it as shown.  Following are the components for each asset:               BALL - RigidBody 2D (Gravity Scale 0), Circle Collider               TWO BOXES - Box Collider 2D               STICK - Box Collider 2D Our next step is to create a distinct scene for the two boxes. We have to create another scene for each for the next position of the boxes.  In this example, we created two scenes: movingBox1 and movingBox2 . Under movingBox1, we have the asset box1 and the next position scene named posNxt1. Same goes for the other scene. For box1, we will assign its next position by clicking the po

HOW TO ADD AND MAKE AN OBJECT MOVE IN UNITY

Image
  Unity  is the world's leading platform for creating and operating interactive, real-time 3D content, providing the tools to make amazing games and publish them to a wide range of devices. In this blog, we will learn how to use the basics of unity specifically, adding an object and how to make it move. 1. OPEN UNITY.  This is unity's main screen. We could see the Scene, Assets, Inspector, and Hierarchy windows.  2. IMPORT ASSETS. We need to import assets that we're going to use in our game. This may include music, pictures, or scripts.  In this example, we're going to import ball png and brick png files we have downloaded. From the asset panel, right click and select  Import New Assets...  A pop up window will appear and select the assets you need.  3. DRAG OBJECT IN THE SCENE PANEL. To create a scene, drag objects in the scene panel. In this example, a ball on the left side with six stacked bricks above a platform in the right side. 4. ADD COMPONENTS TO ASSET. Click t