using UnityEngine;

public class PlayerController : MonoBehaviour
{
	public float speed = 6f;
	public GameObject bulletPrefab;
	public Transform firePoint;

	void Update()
	{
		float horizontal = Input.GetAxis("Horizontal");
		transform.Translate(Vector2.right * horizontal * speed * Time.deltaTime);

		if (Input.GetKeyDown(KeyCode.Space))
		{
			Instantiate(bulletPrefab, firePoint.position, Quaternion.identity);
		}
	}
}