For Developing I am using unity version 5.2.2 you can use above version that will work good Hello 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 Hello welcome to the second post of how to create simple android 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 good all the function of this game are also work on this os If you have to read the first post of how to create simple infinite platform runner game on unity then please click here This is second post of how to create platform runner game on unity. First of all you need to do changes on your previous scrip. The changes are as followOpen your Hero movement Script find the if (WasTouchedOrClicked()) loop and add this code
BoostOnYAxis(); After adding that just play your game on unity. After playing you will see that when you click on the screen or touched on the screen then hero make jump. Here our first part is completed now .Now we are going to create the platform for our android game
First you need to download the above image . The art of this image is from open game art you can download all the art for your unity android project . Just search on Google open game art website . And use on your unity android game project. First of all you need to create platform i.e. that is the base where your hero will jump and we will add script to generate a platform after a specific time . We crate prefab so we can use whenever we need that game object .Creating platform for our game that hero can jump on it
Lets start the work. First open the image which you just download and change the texture type to sprite Now change sprite mode to multiple Then click on sprite editor A popup will show just click on apply . Now choose the platform with help of mouse And click on apply Click on your image it will expand It will look like this as below image Now right click on main camera and create empty game object and name it as platform Click on platform game object and change pos x=8 ,y=0.1, z=1 And our platforms half work is done Now we will create prefab Just create empty game object name it platpre and add components sprite render ,box colider2d, rigidbody 2d And drag the image which you created previously from another image to the sprite render component of platpre sprite option And check is kinematic check box And make transform changes as per below image And delete it from hierarchy and now from the assets we will use this after. Now our work is almost completed … Now right click on the assets window and create c# Script and name it as platformScript andadd the below code to that script . using UnityEngine; using System.Collections; public class HeroMovement : MonoBehaviour { float xspeed = 1.5f; // Use this for initialization void Start () { } // Update is called once per frame void Update () { MoveOnXAxis(); if (WasTouchedOrClicked()) { BoostOnYAxis(); } } bool WasTouchedOrClicked() { if (Input.GetButtonUp("Jump") || Input.GetMouseButtonDown(0) || (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Ended)) return true; else return false; } void MoveOnXAxis() { transform.position += new Vector3(Time.deltaTime * xspeed, 0, 0); } void BoostOnYAxis() { GetComponent().AddForce(new Vector2(0.3f,50f)); } } Previously you just created a game object platform Now drag this script and drop on platform game object on hierarchy . Now click on that at script component of your platform game object you will see that spawan object Now drag the prefab platpre and drop on spawn object And save it our work is completed You just created platform runner game on unity for android . On the next article we will add enemy to it . When our hero collide to the enemy then application will start . Users of games are like to play difficult levels you can make it more difficult by adding some another enemy to this game . If the values of game object is not looking like this then modify the values it will work . Wait for new post of adding enemy and starting game from start. People just love difficult levels to play … Add more enemy . And Don’t forget to save it . this is your hard work so always save what you created always and don’t forget it is your hard work . If you have any question related with this article than write it on comment . Please keep visiting to this blog . Share this post with your friends sharing is easy on Facebook or twitter etc. You can share it with your friends .Just visit Third article of how to create simple android platform runner game on unity added enemy to our android unity game Click here
This is create simple android platform runner game on unity . Thank you for reading how to create simple android platform runner game on unity ..
Internet tricks , how to earn money online , Programming suggetion,Technology information ,apps,wwe result
Friday 30 December 2016
How to create simple android platform runner game on unity part 2
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...
-
बात आज से 5 साल पहले की है. मैंने अपनी जॉब चेंज की और जिस कंपनी को जॉइन किया उसका हेड क्वार्टर बंगलुरू में था. एक सेमिनार के लिए मुझे अपने ...
No comments:
Post a Comment