In This post we are going to create android platform runner game on unity. This is third part of our series . If you want to read the first part thenClick Here In The first part the hero of our android platform runner game on unity is created . If you want to read the Second part thenClick HereIn the second part We added touch and click event to our hero and we added platforms to our android infinite platform runner game on unity For Developing I am using unity version 5.2.2 you can use above version that will work good Unity is my favorite game engine. If you are developing on mac os then this is also good all functions will work fine on above unity version If you are using unity on windows then it is also work good on it Hello This is Third part of how to create or develop android or any other operating system that unity support . In This part we are going to add enemy to our game . We are going to add zombies … Zombies like ghost structure are good for enemy like structure . People like the horror games . If you want more and more users of your android game then I suggesting you to use zombies and other ghost structure to your android or any other operating system game . In this post I am going to show how to add zombies on the game and how zombies can make die to our hero In this post I will show you that when game start and all the game object on the unity editor are starts creating When our hero get touched by the zombies then it will die and our game will be re-startedSo start the work
Start your unity editor First of all you will require assets of your game here I will provide image on zombies to you this image I got from open game art you can use this image on your android unity platform runner game If you want more assets for your game then you can download it from open game art just search it on GoogleI recommend you to use Google app or Google Chrome browser to this site those app can open this site perfectly
So Download the above image
Open it on unity editor . Now Create empty game object on hierarchy and name it as enemy . Click on add component and add rigid body 2d, box collider 2d, and sprite render. Now Select the image you just downloaded and change on inspector window texture type to sprite. When you add sprite render game object to it you will see the sprite option now drag the image which you just downloaded and drop it on Now change the scale as per your connivances i am changing scale x=0.3 y=0.3 z=1 You can modify this values it may be look different on your machine. Now Come to the rigid body 2d component just check the check box shown on the below image Now come with the box collider 2d component just check the is Trigger Check box as shown on image. Now Drag the enemy component from hierarchy game object and drop it on your assets window Now you will see that the name of game object Enemy is in blue color it means this is prefab Now delete this game object from hierarchy window and don’t delete it from assets.Now Let’s start another work
Right Click on your main camera of hierarchy window and create empty game object and name it as RealEnemy now add box collider component on it and select is trigger check boxCreate script for our enemy of platform runner game on unity
Right click on assets and create C# script name it as “enemyscript” make shore that all the script name should be same as class name of the every script otherwise the script will not work properly. Copy the below code and past on your script using UnityEngine; using System.Collections; public class enemyscript : MonoBehaviour { private GameObject SpawnObject; public GameObject SpawnObjects; public float timeMin = 0.7f; public float timeMax = 2f; // Use this for initialization void Start () { SpawnObject = SpawnObjects; Spawn (); } // Update is called once per frame void Update () { } void Spawn() { float x = Random.Range (-1f, 7f); GameObject go = Instantiate (SpawnObject, this.transform.position + new Vector3 (x, -3.5f, 0), Quaternion.identity) as GameObject; Invoke ("Spawn", Random.Range (1, 10)); } }Completing the work of enemy of unity platform runner game
Now Drag the script from assets and drop it on RealEnemy game object on your hierarchy window Do changes on the position of game object scale of game object and all this thing as per below image. Now drag the prefab which you previously created . name enemy and drop it on spawn object our work is completed . RealEnemy will look like this Now you need to make some changes to your heroMovement script this changes is for when hero is touches to the zombies then it should be died if we don’t make this changes then our game will not so good … So open your heromovement script and add this method or function to that script void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Zombi") { Application.LoadLevel (Application.loadedLevelName); } } Now save the game … Our unity android game is almost competed. Our current work is to change the tag of EnemyAdding tag to enemy prefab
Click on your enemy prefab now at inspector window top you will see “Tag ”click on that and add new tag and name it ” zombi “ This name is should be same as name on the hero script onTrigger function or method And add this tag to our enemy prefab Now hit on play button our hero when touches to zombies the game is started from new You just created android platform runner game on unityCreating android app from this game creating apk file
Now at the top left coroner you will seethe “File” now click on that and choose build settings And select android and then click on “ player setting “ at bottom left and then close the build settings nowyou will see player settings on inspector window then write your company name and specify your app icon and fill the other information about your application Now ALL completed just click on “file” again and then build settings and then click on Build Our work is completed and you just created android platform runner game on unity . Take this game example reference only make your changes on the game make it more beautiful if your game look good on screen shot It will downloaded by more users I am suggesting you to download more art from open game art and use it on your game and make your android unity game more and more good . If you want to earn more and more money your game should be played by more users otherwise you will not enough money . You just created android app on unity if you have any questions please write it on comment if you have Google account then adding comment is easy just write your comment . If you have any suggestion related with this article write it on comment Share with your friends sharing is easy please share with your friends … Thank you …
Internet tricks , how to earn money online , Programming suggetion,Technology information ,apps,wwe result
Saturday, 31 December 2016
Create android platform runner game on unity part 3
Subscribe to:
Post Comments (Atom)
how to make money from Amazon
How To make money from Amazon Hello friends today we are going to know how to make money from Amazon. In this tutorial we are going to st...
-
How To add Live Cricket score to your website or blog Hello friends … How are you … Today we going to talk about live cricket score … ...
-
Hello today we talk about how to earn money from Amazon in India. Amazon is one of the biggest market place in the world. You can see dai...
-
How To make money from Amazon Hello friends today we are going to know how to make money from Amazon. In this tutorial we are going to st...
No comments:
Post a Comment