Here is where the problem began, the actual maximum number of jumps is always higher than the value I entered. If (Input.GetKeyDown(Ke圜ode.UpArrow) & NumOfJumps > 0) when jumping, decrease the number of jumps if the player touches the ground, reset the number of jumps here is the horizontal movement update part, but they are IsGrounded = Physics2D.OverlapCircle(GroundCheck.position, check the collision between the "circle" and the ground ![]() Private float NumOfJumps //current number of jumps Public float BaseNumOfJumps //maximum number of jumps Public float radius //radius of the circle Public LayerMask GroundLayer //the layer that the "circle" collide with Public Transform GroundCheck //object that contains the position of the Private bool isGrounded //if the player is touching the ground Public class PlayerController : MonoBehaviour So, here is the code: using System.Collections To do that I need to create a little circle under the player's feet to see if it overlaps the ground, like this Now, as far as I understand in his video, to make a character jump, I need to detect whether the character is touching the ground or not. ![]() ![]() So far I was able to understand most of the video, however, I have met some problem with the Jumping part. I have just started to learn how to make a simple 2D platformer game in Unity, and I have watched Blackthornprod 2D Platformer movement video to learn how to make a character move and jump.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |