Azarian

Around the World in 2 Seconds

by Azarian

Around the World in 2 Seconds Unity

Screenshots

Around the World in 2 Seconds Unity
Around the World in 2 Seconds Unity

Specification

How to Use

Sample Code

using UnityEngine; using System.Collections; public class Player : MonoBehaviour { public GameManager gm; public float jumoForce = 470; //public float jumoForce = 470; public AudioClip jump; public AudioClip dead; Animator anim; public bool canJump = true; void Start() { canJump = true; anim = GetComponent<Animator>(); } void Update() { if (gm.GameStart && canJump) { if (Input.GetMouseButtonDown(0)) { GetComponent<Rigidbody2D>().AddForce(Vector2.up * jumoForce); anim.Play("PlayerJump"); GetComponent&lt;AudioSource&gt;().clip = jump; GetComponent&lt;AudioSource&gt;().Play(); canJump = false; } } } void OnTriggerEnter2D(Collider2D col) { if (col.tag.Contains("Enemy")) { Camera.main.GetComponent<CameraShake>().Shake(); Time.timeScale = 0; gm.GameStart = false; canJump = false; anim.updateMode = AnimatorUpdateMode.UnscaledTime; anim.Play("Dead"); GetComponent&lt;AudioSource&gt;().clip = dead; GetComponent&lt;AudioSource&gt;().Play(); } else if (col.tag.Contains("Ground")) { canJump = true; } } void GameOver() { gm.GameOver(); } }

Video

Comments (0)

  • {{com.username}}
    {{com.username}}
    Buyer
    Seller

    {{com.username}}

    {{com.ctime}}

    {{com.content}}

    • {{com2.username}}
      {{com2.username}}
      Buyer
      Seller

      {{com2.username}}

      {{com2.ctime}}

      {{com2.content}}