Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
19 views1 page

Movement Script

The Mover class in Unity controls player movement using the W, A, S, D keys. It includes a Start method that displays game rules and an Update method that processes player input for movement. The player's position is updated based on horizontal and vertical input axes multiplied by a defined move speed.

Uploaded by

bazeedghori
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Movement Script

The Mover class in Unity controls player movement using the W, A, S, D keys. It includes a Start method that displays game rules and an Update method that processes player input for movement. The player's position is updated based on horizontal and vertical input axes multiplied by a defined move speed.

Uploaded by

bazeedghori
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

using Unity.

VisualScripting;
using UnityEngine;

public class Mover : MonoBehaviour


{
// Start is called once before the first execution of Update after the
MonoBehaviour is created
[SerializeField] float moveSpeed = 10f;
void Start()
{
Rules();

// Update is called once per frame


void Update()
{

Controller();

}
void Rules ()
{
Debug.Log("Welcome to the Game");
Debug.Log("Use W,A,S,D to control the Player");
Debug.Log("If you go out of the Wall you Lose");

void Controller()
{

float Xaxis = Input.GetAxis("Horizontal") * Time.deltaTime * moveSpeed;


float Yaxis = 0.0f;
float Zaxis = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
transform.Translate(Xaxis, Yaxis, Zaxis);

You might also like