Posts

Showing posts from October, 2020

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