﻿using UnityEngine;
using System.Collections;

public class shmupController : MonoBehaviour {

	public float speed = 1;
	public float rotationSpeed = 1;

	private Rigidbody2D r;
	private Transform t;

	private Vector2 move = Vector2.zero;
	private bool rotate = false;

	public Transform[] characters;

	// Use this for initialization
	void Start () {
		r = GetComponent<Rigidbody2D> ();
		t = transform;
	}
	
	// Update is called once per frame
	void Update () {
	
		move.x = Input.GetAxisRaw ("Horizontal");
		move.y = Input.GetAxisRaw ("Vertical");

		if (Input.GetButtonDown("Fire1")) {

			t.Rotate(new Vector3(0,0,90));

		}

	//	if (Input.GetButtonDown ("Fire1")) rotate = true;
	//	if (Input.GetButtonUp ("Fire1")) rotate = false;

	}

	void FixedUpdate () {
		
		r.AddForce (move * Time.deltaTime * speed);

	//	if (rotate)	r.AddTorque (rotationSpeed * Time.deltaTime);

		/*for (int n = 0; n < characters.Length; n++) {

			characters[n].

		}*/
		
	}
}
