bro, i have a problem with the code, everything its fine but the heal dont slow, its like static and dont down the life, and i read everysingle code and not have a solution, do you know why? thanks for reading
Click on the object Player, and in the inspector you will see "Tag", is the first option in the window. Select this Tag and click on the "Player". And in the if, inside OnCollisionEnter2D. Change "PlayerHealth.instance.tag == ""Player" to "collision.gameObject.CompareTag("Player")". It will work!!
I hate “montage magic”, before editing the Enemy Move code there was a RigidBody component and then disappeared, and I can’t understand why my enemy is twitching. Better not do that.
This is the First script code (Changed a bit works the same) !(EDIT)! this is new code to reduce glide using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMove : MonoBehaviour { public float moveSpeed = 5f; // Speed of the player public CharacterController characterController; // Reference to the CharacterController public Transform cameraTransform; // Reference to the Camera Transform private Vector3 moveInput; // Update is called once per frame void Update() { MovePlayer(); } void MovePlayer() { // Get input float verticalInput = Input.GetAxis("Vertical"); float horizontalInput = Input.GetAxis("Horizontal"); // Calculate movement direction Vector3 verticalMove = cameraTransform.forward * verticalInput; Vector3 horizontalMove = cameraTransform.right * horizontalInput; // Combine movements moveInput = horizontalMove + verticalMove; if (moveInput.magnitude > 1f) { moveInput.Normalize(); } // Apply movement characterController.Move(moveInput * moveSpeed * Time.deltaTime); // Stop the player immediately if there is no input if (verticalInput == 0 && horizontalInput == 0) { moveInput = Vector3.zero; characterController.Move(moveInput); } } }
Just a small detail, don't know if you forgot to record it or if it was some kind of bug on my end, but the video is missing the part of assigning the player character to the animator variable in the inspector, thus resulting in a 'UnassigedReferenceException' and the moving animations not working. Cheers, I'm really enjoying these videos, would just wish it had some kind of voice over!
Почти получилось!))) В скрипте отсчет идет (в инспекторе), а на экране меняется формат с 0:00 на 00:(00:00) и отсчета нет...((( не пойму в чем дело... Есть варианты?