Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class ball : MonoBehaviour {
- public Rigidbody2D rb;
- void Start ()
- {
- this.GetComponent<Rigidbody2D>().AddForce (-transform.up * 100f);
- }
- void Update ()
- {
- if ((transform.position.x > 9.40f) || (transform.position.x < -9.40f))
- {
- transform.position=new Vector2(0.0f,0.0f);
- }
- if ((transform.position.y > 5.55f) || (transform.position.y < -5.55f))
- {
- transform.position=new Vector2(0.0f,0.0f);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement