Unity + win8.1 apps game demo, unitywin8.1
Unity3d is used by many people... I was trying to write a 3d game .. .. It seems quite troublesome .. ..... Use unity to write a simple 2d game ..
(Adsw press ENTER or touch screen virtual joystick)
Development Environment unity4.5.1f3 vs2013 express win8.1
The implementation method is as follows:
1. Create your own tank Sprite
2. Create an enemy tank Prefab
3. Create a bullet Prefab
4. Add a virtual joystick
5. Collision Detection
Implementation
1. Control the code of your own tank
if (Input.GetKey (KeyCode.W)) {Rotate (0);} else if (Input.GetKey (KeyCode.S)) {Rotate (180);} else if (Input.GetKey (KeyCode.A)) {Rotate (90);} else if (Input.GetKey (KeyCode.D)) {Rotate (270);}i++;if (i == 10) {i=0;if (Input.GetKey (KeyCode.Return)||rotateJoystick.tapCount > 0) {m.tag = "GOOD";Instantiate (m, transform.position, transform.rotation);}}
2. Code for controlling local tanks
if (step == 0){int i=Random.Range(0, 4);Rotate(angles[i]);step = Random.Range(0, 20) + 85;if(Random.Range(0,50)>40){m.tag="BAD";Instantiate(m, transform.position, transform.rotation);}}else{step--;}transform.Translate (Vector3.up*Time.deltaTime*4);
3. Control bullet Movement
Transform. Translate (Vector3.up * Time. deltaTime * 10 );
4. Standard Assets (Mobile). unityPackage
5. Collision Detection code
void OnTriggerEnter2D(Collider2D mCollider){if ((mCollider.gameObject.tag == "Enemy"&&gameObject.tag=="GOOD")||(mCollider.gameObject.tag == "Player"&&gameObject.tag=="BAD")){Destroy(mCollider.gameObject);Destroy(this.gameObject);if(gameObject.tag=="BAD"){PlayerPrefs.SetString("key","OVER");Application.LoadLevel(1);}}}
Code download: http://download.csdn.net/detail/xiaoxiao108/7674235
If you find anything unreasonable and need improvement, leave a message. Or you can contact me via 328452421@qq.com. Thank you very much.
Unity cannot be installed in win81.
Path cannot contain Chinese Characters
WIN81 unzip swsapps File
There is no such folder!
Pan.baidu.com/s/1l9uKZ
The folder is ready !!!