I liked the map but the ui in the bweginning could match the game a bit more
BenjisCode
Creator of
Recent community posts
il rate as many games as i have time with please rate our game https://itch.io/jam/brackeys-14/rate/3844173
Yo ima try your game give me and my friends game a honest review also https://itch.io/jam/brackeys-14/rate/3844173
using System.Data;
using UnityEngine;
public class TestMovementNmr2 : MonoBehaviour
{
public float walkSpeed = 10f;
public float currentSpeed;
public float shiftSpeed = 3f;
private CharacterController controller;
Vector3 velocity;
public float jumpHeight = 3f;
public float shiftJumpHeight = 1f;
public float groundCheckDistance = 0.4f;
public LayerMask groundMask;
public Transform groundCheck;
public float gravity = -18f;
bool isGrounded;
private void Start()
{
controller = GetComponent<CharacterController>();
currentSpeed = walkSpeed;
}
private void Update()
{
// Ground check
isGrounded = Physics.CheckSphere(groundCheck.position, groundCheckDistance, groundMask);
if (isGrounded && velocity.y < 0)
{
velocity.y = -2f; // Keeps the player stuck to the ground
}
// Movement input
float X = Input.GetAxis("Horizontal");
float Z = Input.GetAxis("Vertical");
Vector3 move = transform.right * X + transform.forward * Z;
// shift speed
if (Input.GetKey(KeyCode.LeftShift) && isGrounded)
currentSpeed = shiftSpeed;
else
currentSpeed = walkSpeed;
controller.Move(move * currentSpeed * Time.deltaTime);
// Jumping
if (Input.GetButtonDown("Jump") && isGrounded)
{
float jumpMultiplier = Input.GetKey(KeyCode.LeftShift) ? 0.5f : 1f;
velocity.y = Mathf.Sqrt(jumpHeight * jumpMultiplier * -2f * gravity);
}
// Gravity
velocity.y += gravity * Time.deltaTime;
controller.Move(velocity * Time.deltaTime);
}
}