Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UnityEngine
- import System.Collections
- public class Shooter(MonoBehaviour):
- public projectile as Rigidbody
- public shotPos as Transform
- public shotForce as single = 1000.0F
- public moveSpeed as single = 10.0F
- private def Update():
- h as single = ((Input.GetAxis('Horizontal') * Time.deltaTime) * moveSpeed)
- v as single = ((Input.GetAxis('Vertical') * Time.deltaTime) * moveSpeed)
- if transform.position.x>6:
- h = 0;
- transform.Translate(Vector3(h, v, 0.0f))
- print(transform.position.x);
- if Input.GetButtonUp('Fire1'):
- shot = (Instantiate(projectile, shotPos.position, shotPos.rotation) as Rigidbody)
- shot.AddForce((shotPos.forward * shotForce))
Advertisement
RAW Paste Data
Copied
Advertisement