Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.IO;
  4.  
  5. public class characterController : MonoBehaviour {
  6.     float moveX;
  7.     float moveY;
  8.     public  float movespeed = 300;
  9.     public Rigidbody2D rb;
  10.     private Vector2 movement;
  11.  
  12.     void Start()
  13.     {
  14.  
  15.     }
  16.  
  17.     void Update()
  18.     {    if (Input.touchCount > 0) {
  19.             Rigidbody2D rb = GetComponent<Rigidbody2D>();
  20.             float posTouch=Input.GetTouch(0).position.x;
  21.             if(posTouch<Screen.height/2)
  22.                 rb.AddForce(new Vector2(0,movespeed));
  23.                
  24.            
  25.         }
  26.     }
  27.    
  28.     void OnTriggerEnter2D(Collider2D obj)
  29.     {
  30.        
  31.  
  32.     }
  33.    
  34.  
  35.    
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement