using UnityEngine;
using System.Collections;
public class Ball : MonoBehaviour {
public Paddle paddle;
private Vector3 paddleToBallVector;
private bool hasStarted = false;
// Use this for initialization
void Start () {
paddleToBallVector = this.transform.position - paddle.transform.position;
}
// Update is called once per frame
void Update () {
if (!hasStarted) {
this.transform.position = paddle.transform.position + paddleToBallVector;
if (Input.GetMouseButtonDown (0)) {
print ("Mouse Clicked, launch ball.");
hasStarted = true;
Ball.rigidbody2D.velocity = new Vector2(2f, 10f);
}
}
}
}
It seems that there is something wrong in my
`Ball.rigidbody2D.velocity = new Vector2(2f,10f);` line (CS0120) and I have no idea. The guys who made that tutorial has no problem there, but I've got "velocity" with red, telling me it has no definition for "velocity" (error CS0117) ...
Any ideas?
The line is 26 `(26, 30)`.
↧