Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Laser : MonoBehaviour {
- private Transform TS;
- public int Speed = 7;
- // Use this for initialization
- void Start () {
- TS = transform;
- }
- // Update is called once per frame
- void Update () {
- //Space bar shoots the laser!
- TS.Translate (Vector3.up * Speed * Time.deltaTime);
- if (TS.position.y>5.3) {
- Object.Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement