Click here for free DL of the app version that can save data.
No:44624 102
Prev Next
Suomalainen peli
Developer User19438|Date and time 24/2/18 21:20:33
Build time 4.679 sec|Game capacity 2.51KB|Script



using UnityEngine; public class PlayerMovement : MonoBehaviour { public float moveSpeed = 5f; void Update() { float horizontalInput = Input.GetAxis("Horizontal"); float verticalInput = Input.GetAxis("Vertical"); Vector3 moveDirection = new Vector3(horizontalInput, 0f, verticalInput).normalized; Vector3 moveAmount = moveDirection * moveSpeed * Time.deltaTime; transform.Translate(moveAmount); } } using UnityEngine; public class AIGameCreator : MonoBehaviour { public GameObject objectPrefab; // Tämä on objektin prefabi, jonka haluat luoda void Start() { CreateObject(); } void CreateObject() { // Määrittele satunnainen sijainti kentällä float randomX = Random.Range(-5f, 5f); // Määrittele satunnainen x-koordinaatti float randomZ = Random.Range(-5f, 5f); // Määrittele satunnainen z-koordinaatti Vector3 spawnPosition = new Vector3(randomX, 0.5f, randomZ); // Objekti sijoitetaan hieman ylöspäin maasta // Luo objekti ja aseta sen sijainti GameObject newObject = Instantiate(objectPrefab, spawnPosition, Quaternion.identity); } }

Prev Next   Back  0  0 Menu 
 
 
 
 

[PR]現在の新着人気ランキング

Click here for free DL of the app version that can save data.

(C)2023 HisashiApp