mirror of
https://github.com/kuhyx/praca_magisterska.git
synced 2026-07-04 12:03:01 +02:00
20 lines
530 B
C#
20 lines
530 B
C#
using UnityEngine;
|
|
|
|
|
|
public class PlayerController : MonoBehaviour
|
|
{
|
|
public GameObject bulletPrefab;
|
|
public Transform shootPoint;
|
|
public float speed = 5f;
|
|
|
|
void Update()
|
|
{
|
|
float moveX = Input.GetAxis("Horizontal");
|
|
float moveY = Input.GetAxis("Vertical");
|
|
transform.position += new Vector3(moveX, moveY, 0) * speed * Time.deltaTime;
|
|
if (Input.GetKeyDown(KeyCode.Space))
|
|
{
|
|
Instantiate(bulletPrefab, shootPoint.position, Quaternion.identity);
|
|
}
|
|
}
|
|
} |