Happyland Land Adventures HD
https://blackrookgames.itch.io/happyadvhd
https://redd.it/1k7yv0v
@r_Unity3D
https://blackrookgames.itch.io/happyadvhd
https://redd.it/1k7yv0v
@r_Unity3D
Stamina Bar
I started learning Unity yesterday and I'm working on implementing a stamina bar to my project. Here is a link to a video of what I have so far. Code:
As you can see in the video, the player dashes correctly, and stamina is drained, but it doesn't refill. I feel like I'm missing something obvious but idk what.
https://redd.it/1k80kp6
@r_Unity3D
I started learning Unity yesterday and I'm working on implementing a stamina bar to my project. Here is a link to a video of what I have so far. Code:
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class PlayerMovement : MonoBehaviour{// Start is called before the first frame updatepublic float moveSpeed;public Rigidbody2D rb;private Vector2 moveDirection;[SerializeField] private TrailRenderer tr;[SerializeField] float dashSpeed = 10f;[SerializeField] float dashDuration = 1f;[SerializeField] float dashCooldown = 1f;[SerializeField] bool isDashing = false;public Image StaminaBar;public float stamina, maxStamina;public float dashCost;public bool canDash;private float chargeRate;private Coroutine recharge;// Update is called once per framevoid Update(){if (isDashing){return;}ProcessInputs();if (Input.GetKeyDown(KeyCode.Space)){StartCoroutine(Dash());}}private void FixedUpdate(){if (isDashing){return;}Move();}void ProcessInputs(){float movex = Input.GetAxisRaw("Horizontal");float movey = Input.GetAxisRaw("Vertical");moveDirection = new Vector2(movex, movey).normalized;}private void Move(){ rb.velocity = new Vector2(moveDirection.x * moveSpeed, moveDirection.y * moveSpeed);}private IEnumerator Dash(){isDashing = true;stamina -= dashCost;if(stamina < 0)stamina = 0;StaminaBar.fillAmount = stamina / maxStamina;rb.velocity = new Vector2(moveDirection.x * dashSpeed, moveDirection.y * dashSpeed);tr.emitting = true;yield return new WaitForSeconds(dashDuration);tr.emitting = false;isDashing = false;if (recharge != null){StopCoroutine(recharge);recharge = StartCoroutine(RechargeStamina());}}private IEnumerator RechargeStamina(){yield return new WaitForSeconds(1f);while(stamina < maxStamina){stamina += chargeRate / 10f;if(stamina > maxStamina)stamina = maxStamina;StaminaBar.fillAmount = stamina / maxStamina;yield return new WaitForSeconds(.1f);}}}As you can see in the video, the player dashes correctly, and stamina is drained, but it doesn't refill. I feel like I'm missing something obvious but idk what.
https://redd.it/1k80kp6
@r_Unity3D
YouTube
Space Battle Development - Basic Movement & Dashing
This is a game I'm working on as I learn Unity
having fun with RealtimeCSG and baked lighting, going for some Source Engine vibes
https://redd.it/1k7xysc
@r_Unity3D
https://redd.it/1k7xysc
@r_Unity3D
Reddit
From the Unity3D community on Reddit: having fun with RealtimeCSG and baked lighting, going for some Source Engine vibes
Explore this post and more from the Unity3D community
Media is too big
VIEW IN TELEGRAM
I made a breakdown video of the melee aim assist + animation overide setup in my game
https://redd.it/1k86dps
@r_Unity3D
https://redd.it/1k86dps
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
We are working on a chill organizing game where you sort, stack, and organize items into spaces. Here’s a first look!
https://redd.it/1k8cbac
@r_Unity3D
https://redd.it/1k8cbac
@r_Unity3D