Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.IO;
- public class characterController : MonoBehaviour {
- float moveX;
- float moveY;
- public float movespeed = 300;
- public Rigidbody2D rb;
- private Vector2 movement;
- void Start()
- {
- }
- void Update()
- { if (Input.touchCount > 0) {
- Rigidbody2D rb = GetComponent<Rigidbody2D>();
- float posTouch=Input.GetTouch(0).position.x;
- if(posTouch<Screen.height/2)
- rb.AddForce(new Vector2(0,movespeed));
- }
- }
- void OnTriggerEnter2D(Collider2D obj)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement