This media is not supported in your browser
VIEW IN TELEGRAM
We've been working on this RPG city builder for over 2 years, and today we've launched Airborne Empire into Early Access! We're so excited!
https://redd.it/1i0j6a3
@r_Unity3D
https://redd.it/1i0j6a3
@r_Unity3D
Transparency problem in background
https://preview.redd.it/elu3uo1ufvce1.png?width=1911&format=png&auto=webp&s=36b38e43c91e9bf7c5bf24ce2d11ab8cf777d905
Hi, im a noob in unity - im doing school project nad idk why the background is transparent? Can someone help me fix it? I really don't know anything about unity i was following a tutorial and the guy didn't have that problem. Any tips would be helpful :) And it's animated that's why it's sliced
https://redd.it/1i0vxbi
@r_Unity3D
https://preview.redd.it/elu3uo1ufvce1.png?width=1911&format=png&auto=webp&s=36b38e43c91e9bf7c5bf24ce2d11ab8cf777d905
Hi, im a noob in unity - im doing school project nad idk why the background is transparent? Can someone help me fix it? I really don't know anything about unity i was following a tutorial and the guy didn't have that problem. Any tips would be helpful :) And it's animated that's why it's sliced
https://redd.it/1i0vxbi
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
Hey guys, I’ve been posting some of my shader work online for download. If you’re interested in this kind of shaders, you can acquire them on the link in the comments.
https://redd.it/1i105o2
@r_Unity3D
https://redd.it/1i105o2
@r_Unity3D
Acceleration And Deceleration Help
So I'm trying to make my controls bit smoother for my fast paced 2D platformer, so I'm trying to make it where when you start moving there is a small build up till you get to your normal move speed, and you take some time to slowdown before you come to a stop, help would be appreciated, apologies, I'm still fairly new to game development!
The Whole Player Script:
Header ("ControllerInput")
public InputActionReference move;
public InputActionReference jumpAction;
public InputActionReference crouchAction;
public InputActionReference spinAction;
public InputActionReference bombAction;
public InputActionReference brakeAction;
public InputActionReference groundPoundAction;
public InputActionReference danceAction;
Header ("Particles")
public ParticleSystem danceParticle;
Header("Floats And Bools")
public float moveSpeed = 5f;
public float jumpForce = 3f;
public float wallJumpForce = 2f;
public float shortJumpMultiplier = 0.5f;
public float decelerationFactor = 0.1f;
public float minSpeed = 0.1f;
public bool canJump;
public bool spin;
public bool dive;
public bool slam;
public bool slamCancel;
public bool canWallBounce;
public bool bumped;
public bool rolling;
public bool landAnimation;
public bool facingLeft;
public bool freeMove;
public bool walk;
public bool blasted;
public bool dance;
public bool wallWalk;
public bool ceilingAbove;
public bool canDash = true;
public bool isDashing;
public bool jumpCanceled;
public bool canDiveBomb;
public bool diveBombed;
public bool spinDive;
Header("Dash Speeds")
public bool dash1;
public bool dash2;
public bool dash3;
public bool dash4;
Header("Dash Timer")
public float idleThreshold = 3f;
private float idleTime = 0f;
Header("Layers And Transforms")
public Transform groundCheck;
public Transform ceilingCheck;
public LayerMask groundLayer;
public LayerMask ceilingLayer;
Header("Private")
private Rigidbody2D playerRb;
private Animator playerAnim;
private Vector2 moveDirection;
private Vector2 lastDirection;
private bool isJumping;
private bool danceAir;
private float dashingTime = 0.25f;
SerializeField bool isBraking = false;
SerializeField bool crouching;
SerializeField Collider2D standingCollider;
SerializeField Collider2D crouchingCollider;
const float aboveCheckRadius = 0.2f;
void Start()
{
playerRb = GetComponent<Rigidbody2D>();
playerAnim = GetComponent<Animator>();
jumpAction.action.performed += JumpPerformed;
jumpAction.action.canceled += JumpCanceled;
crouchAction.action.performed += CrouchPerformed;
crouchAction.action.canceled += CrouchCanceled;
spinAction.action.performed += SpinPerformed;
brakeAction.action.performed += BrakePerformed;
groundPoundAction.action.performed += GroundPoundPerformed;
bombAction.action.performed += BombPerformed;
danceAction.action.performed += DancePerformed;
danceAction.action.canceled += DanceCanceled;
}
void OnDestroy()
{
// Unsubscribe to prevent memory leaks
jumpAction.action.performed -= JumpPerformed;
jumpAction.action.canceled -= JumpCanceled;
crouchAction.action.performed -= CrouchPerformed;
crouchAction.action.canceled -= CrouchCanceled;
spinAction.action.performed -= SpinPerformed;
brakeAction.action.performed
So I'm trying to make my controls bit smoother for my fast paced 2D platformer, so I'm trying to make it where when you start moving there is a small build up till you get to your normal move speed, and you take some time to slowdown before you come to a stop, help would be appreciated, apologies, I'm still fairly new to game development!
The Whole Player Script:
Header ("ControllerInput")
public InputActionReference move;
public InputActionReference jumpAction;
public InputActionReference crouchAction;
public InputActionReference spinAction;
public InputActionReference bombAction;
public InputActionReference brakeAction;
public InputActionReference groundPoundAction;
public InputActionReference danceAction;
Header ("Particles")
public ParticleSystem danceParticle;
Header("Floats And Bools")
public float moveSpeed = 5f;
public float jumpForce = 3f;
public float wallJumpForce = 2f;
public float shortJumpMultiplier = 0.5f;
public float decelerationFactor = 0.1f;
public float minSpeed = 0.1f;
public bool canJump;
public bool spin;
public bool dive;
public bool slam;
public bool slamCancel;
public bool canWallBounce;
public bool bumped;
public bool rolling;
public bool landAnimation;
public bool facingLeft;
public bool freeMove;
public bool walk;
public bool blasted;
public bool dance;
public bool wallWalk;
public bool ceilingAbove;
public bool canDash = true;
public bool isDashing;
public bool jumpCanceled;
public bool canDiveBomb;
public bool diveBombed;
public bool spinDive;
Header("Dash Speeds")
public bool dash1;
public bool dash2;
public bool dash3;
public bool dash4;
Header("Dash Timer")
public float idleThreshold = 3f;
private float idleTime = 0f;
Header("Layers And Transforms")
public Transform groundCheck;
public Transform ceilingCheck;
public LayerMask groundLayer;
public LayerMask ceilingLayer;
Header("Private")
private Rigidbody2D playerRb;
private Animator playerAnim;
private Vector2 moveDirection;
private Vector2 lastDirection;
private bool isJumping;
private bool danceAir;
private float dashingTime = 0.25f;
SerializeField bool isBraking = false;
SerializeField bool crouching;
SerializeField Collider2D standingCollider;
SerializeField Collider2D crouchingCollider;
const float aboveCheckRadius = 0.2f;
void Start()
{
playerRb = GetComponent<Rigidbody2D>();
playerAnim = GetComponent<Animator>();
jumpAction.action.performed += JumpPerformed;
jumpAction.action.canceled += JumpCanceled;
crouchAction.action.performed += CrouchPerformed;
crouchAction.action.canceled += CrouchCanceled;
spinAction.action.performed += SpinPerformed;
brakeAction.action.performed += BrakePerformed;
groundPoundAction.action.performed += GroundPoundPerformed;
bombAction.action.performed += BombPerformed;
danceAction.action.performed += DancePerformed;
danceAction.action.canceled += DanceCanceled;
}
void OnDestroy()
{
// Unsubscribe to prevent memory leaks
jumpAction.action.performed -= JumpPerformed;
jumpAction.action.canceled -= JumpCanceled;
crouchAction.action.performed -= CrouchPerformed;
crouchAction.action.canceled -= CrouchCanceled;
spinAction.action.performed -= SpinPerformed;
brakeAction.action.performed
-= BrakePerformed;
groundPoundAction.action.performed -= GroundPoundPerformed;
bombAction.action.performed -= BombPerformed;
danceAction.action.performed -= DancePerformed;
danceAction.action.canceled -= DanceCanceled;
}
void Update()
{
if (isDashing)
{
return;
}
#region MOVEMENT/JUMPING ANIMATIONS
float smoothedVelocityX = Mathf.Lerp(playerAnim.GetFloat("xVelocity"), Mathf.Abs(playerRb.velocity.x), Time.deltaTime 150f);
playerAnim.SetFloat("xVelocity", smoothedVelocityX);
if (wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", true);
spin = false;
}
else if (!wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", false);
}
if (!dance && isGrounded())
{
playerAnim.SetBool("Dance", false);
}
else if (dance && isGrounded() && !dash1)
{
playerAnim.SetBool("Dance", true);
}
if (isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", true);
danceAir = false;
}
else if (!isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", false);
danceAir = true;
}
bool isJumping = playerRb.velocity.y > 0.1f;
bool isFalling = playerRb.velocity.y < -0.1f;
if (!slam)
{
playerAnim.SetBool("Jump", isJumping);
if (!jumpCanceled)
{
playerAnim.SetBool("Fall", isFalling);
}
}
#endregion
#region WALK/DASH MOVEMENT
Flip();
if (!dive && !isBraking && !rolling && !walk && !dash4)
{
moveDirection = move.action.ReadValue<Vector2>();
}
if (isGrounded())
{
canJump = true;
canWallBounce = true;
slamCancel = false;
canDash = true;
jumpCanceled = false;
diveBombed = false;
spinDive = false;
playerAnim.SetBool("Fall", false);
playerAnim.SetBool("SlamCancel", false);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("Grounded", true);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
StartCoroutine(SlamFallAnimationEnd());
}
else
{
canJump = false;
}
if (!isGrounded())
{
playerAnim.SetBool("Grounded", false);
}
if(isGrounded() && isDashing)
{
isDashing = false;
}
if (!bumped && !dash1 && !isBraking)
{
moveSpeed = 9;
}
if (moveDirection.x == 0f && isGrounded() && !dash4)
{
idleTime += Time.deltaTime;
}
else
{
idleTime = 0f;
}
if (idleTime >= idleThreshold 4 && dash1 && isGrounded() && !dash4 && !bumped)
{
dash1 = false;
}
else if (idleTime >= idleThreshold 3 && dash2 && isGrounded() && !dash4 && !bumped)
{
dash2 = false;
}
else if (idleTime >= idleThreshold 2 && dash3 && isGrounded() && !dash4 && !bumped)
{
dash3 = false;
}
#endregion
#region DASH 4 MOVEMENT
if (!dive && !isBraking && !rolling && !bumped)
{
groundPoundAction.action.performed -= GroundPoundPerformed;
bombAction.action.performed -= BombPerformed;
danceAction.action.performed -= DancePerformed;
danceAction.action.canceled -= DanceCanceled;
}
void Update()
{
if (isDashing)
{
return;
}
#region MOVEMENT/JUMPING ANIMATIONS
float smoothedVelocityX = Mathf.Lerp(playerAnim.GetFloat("xVelocity"), Mathf.Abs(playerRb.velocity.x), Time.deltaTime 150f);
playerAnim.SetFloat("xVelocity", smoothedVelocityX);
if (wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", true);
spin = false;
}
else if (!wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", false);
}
if (!dance && isGrounded())
{
playerAnim.SetBool("Dance", false);
}
else if (dance && isGrounded() && !dash1)
{
playerAnim.SetBool("Dance", true);
}
if (isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", true);
danceAir = false;
}
else if (!isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", false);
danceAir = true;
}
bool isJumping = playerRb.velocity.y > 0.1f;
bool isFalling = playerRb.velocity.y < -0.1f;
if (!slam)
{
playerAnim.SetBool("Jump", isJumping);
if (!jumpCanceled)
{
playerAnim.SetBool("Fall", isFalling);
}
}
#endregion
#region WALK/DASH MOVEMENT
Flip();
if (!dive && !isBraking && !rolling && !walk && !dash4)
{
moveDirection = move.action.ReadValue<Vector2>();
}
if (isGrounded())
{
canJump = true;
canWallBounce = true;
slamCancel = false;
canDash = true;
jumpCanceled = false;
diveBombed = false;
spinDive = false;
playerAnim.SetBool("Fall", false);
playerAnim.SetBool("SlamCancel", false);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("Grounded", true);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
StartCoroutine(SlamFallAnimationEnd());
}
else
{
canJump = false;
}
if (!isGrounded())
{
playerAnim.SetBool("Grounded", false);
}
if(isGrounded() && isDashing)
{
isDashing = false;
}
if (!bumped && !dash1 && !isBraking)
{
moveSpeed = 9;
}
if (moveDirection.x == 0f && isGrounded() && !dash4)
{
idleTime += Time.deltaTime;
}
else
{
idleTime = 0f;
}
if (idleTime >= idleThreshold 4 && dash1 && isGrounded() && !dash4 && !bumped)
{
dash1 = false;
}
else if (idleTime >= idleThreshold 3 && dash2 && isGrounded() && !dash4 && !bumped)
{
dash2 = false;
}
else if (idleTime >= idleThreshold 2 && dash3 && isGrounded() && !dash4 && !bumped)
{
dash3 = false;
}
#endregion
#region DASH 4 MOVEMENT
if (!dive && !isBraking && !rolling && !bumped)
{
moveDirection = move.action.ReadValue<Vector2>();
if (dash4 && !freeMove)
{
if (moveDirection != Vector2.zero)
{
lastDirection = moveDirection;
walk = true;
}
else
{
moveDirection = lastDirection;
walk = false;
}
}
else
{
walk = false;
}
}
if (!dash4)
{
playerRb.velocity = new Vector2(moveDirection.x moveSpeed, playerRb.velocity.y);
}
else
{
playerRb.velocity = new Vector2(moveDirection.x moveSpeed, playerRb.velocity.y);
}
if(dash4 && isGrounded())
{
freeMove = false;
}
#endregion
#region BOMB SLAM
if (isGrounded() && slam && !slamCancel && dash4 && dash3 && dash2 && dash1 && !dance)
{
slam = false;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if(isGrounded() && slam && !slamCancel && dash3 && dash2 && dash1 && !dance)
{
slam = false;
dash4 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash2 && dash1 && !dance)
{
slam = false;
dash3 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash1 && !dance)
{
slam = false;
dash2 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && !dash1 && !dance)
{
slam = false;
dash1 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
#endregion
#region BRAKING/SPEED LOGIC
if (isBraking)
{
Dash1Deceleration();
}
else if (!isBraking)
{
if (dash4 && dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 21f;
}
else if (dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 18f;
}
else if (dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 15f;
}
else if (dash1 && !dive && !dance && !bumped)
{
moveSpeed = 12f;
}
else if (!dive &&
if (dash4 && !freeMove)
{
if (moveDirection != Vector2.zero)
{
lastDirection = moveDirection;
walk = true;
}
else
{
moveDirection = lastDirection;
walk = false;
}
}
else
{
walk = false;
}
}
if (!dash4)
{
playerRb.velocity = new Vector2(moveDirection.x moveSpeed, playerRb.velocity.y);
}
else
{
playerRb.velocity = new Vector2(moveDirection.x moveSpeed, playerRb.velocity.y);
}
if(dash4 && isGrounded())
{
freeMove = false;
}
#endregion
#region BOMB SLAM
if (isGrounded() && slam && !slamCancel && dash4 && dash3 && dash2 && dash1 && !dance)
{
slam = false;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if(isGrounded() && slam && !slamCancel && dash3 && dash2 && dash1 && !dance)
{
slam = false;
dash4 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash2 && dash1 && !dance)
{
slam = false;
dash3 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash1 && !dance)
{
slam = false;
dash2 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && !dash1 && !dance)
{
slam = false;
dash1 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
#endregion
#region BRAKING/SPEED LOGIC
if (isBraking)
{
Dash1Deceleration();
}
else if (!isBraking)
{
if (dash4 && dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 21f;
}
else if (dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 18f;
}
else if (dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 15f;
}
else if (dash1 && !dive && !dance && !bumped)
{
moveSpeed = 12f;
}
else if (!dive &&
!dance && !bumped)
{
moveSpeed = 9;
}
}
#endregion
}
private void FixedUpdate()
{
Crouch(crouching);
if (dive && isGrounded())
{
DiveDeceleration();
}
}
#region CONTROLS
void Flip()
{
if (playerRb.velocity.x < 0 && !facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = true;
transform.Rotate(0f, 180f, 0f);
}
else if (playerRb.velocity.x > 0 && facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = false;
transform.Rotate(0f, 180f, 0f);
}
}
private void JumpPerformed(InputAction.CallbackContext context)
{
if (canJump && !crouching && isGrounded() && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, jumpForce);
}
else if(crouching && canJump && isGrounded() && playerRb.velocity.x == 0 && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, 8);
}
if (slam)
{
playerRb.velocity = new Vector2(0, 14);
playerRb.gravityScale = 3;
slam = false;
slamCancel = true;
freeMove = true;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamCancel", true);
}
#region DIVING
if (crouching && dash1 && dash2 && dash3 && dash4 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && dash3 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
}
#endregion
}
private void
{
moveSpeed = 9;
}
}
#endregion
}
private void FixedUpdate()
{
Crouch(crouching);
if (dive && isGrounded())
{
DiveDeceleration();
}
}
#region CONTROLS
void Flip()
{
if (playerRb.velocity.x < 0 && !facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = true;
transform.Rotate(0f, 180f, 0f);
}
else if (playerRb.velocity.x > 0 && facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = false;
transform.Rotate(0f, 180f, 0f);
}
}
private void JumpPerformed(InputAction.CallbackContext context)
{
if (canJump && !crouching && isGrounded() && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, jumpForce);
}
else if(crouching && canJump && isGrounded() && playerRb.velocity.x == 0 && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, 8);
}
if (slam)
{
playerRb.velocity = new Vector2(0, 14);
playerRb.gravityScale = 3;
slam = false;
slamCancel = true;
freeMove = true;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamCancel", true);
}
#region DIVING
if (crouching && dash1 && dash2 && dash3 && dash4 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && dash3 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
}
#endregion
}
private void
Acceleration And Deceleration Help
So I'm trying to make my controls bit smoother for my fast paced 2D platformer, so I'm trying to make it where when you start moving there is a small build up till you get to your normal move speed, and you take some time to slowdown before you come to a stop, help would be appreciated, apologies, I'm still fairly new to game development!
The Whole Player Script:
[Header ("ControllerInput")]
public InputActionReference move;
public InputActionReference jumpAction;
public InputActionReference crouchAction;
public InputActionReference spinAction;
public InputActionReference bombAction;
public InputActionReference brakeAction;
public InputActionReference groundPoundAction;
public InputActionReference danceAction;
[Header ("Particles")]
public ParticleSystem danceParticle;
[Header("Floats And Bools")]
public float moveSpeed = 5f;
public float jumpForce = 3f;
public float wallJumpForce = 2f;
public float shortJumpMultiplier = 0.5f;
public float decelerationFactor = 0.1f;
public float minSpeed = 0.1f;
public bool canJump;
public bool spin;
public bool dive;
public bool slam;
public bool slamCancel;
public bool canWallBounce;
public bool bumped;
public bool rolling;
public bool landAnimation;
public bool facingLeft;
public bool freeMove;
public bool walk;
public bool blasted;
public bool dance;
public bool wallWalk;
public bool ceilingAbove;
public bool canDash = true;
public bool isDashing;
public bool jumpCanceled;
public bool canDiveBomb;
public bool diveBombed;
public bool spinDive;
[Header("Dash Speeds")]
public bool dash1;
public bool dash2;
public bool dash3;
public bool dash4;
[Header("Dash Timer")]
public float idleThreshold = 3f;
private float idleTime = 0f;
[Header("Layers And Transforms")]
public Transform groundCheck;
public Transform ceilingCheck;
public LayerMask groundLayer;
public LayerMask ceilingLayer;
[Header("Private")]
private Rigidbody2D playerRb;
private Animator playerAnim;
private Vector2 moveDirection;
private Vector2 lastDirection;
private bool isJumping;
private bool danceAir;
private float dashingTime = 0.25f;
[SerializeField] bool isBraking = false;
[SerializeField] bool crouching;
[SerializeField] Collider2D standingCollider;
[SerializeField] Collider2D crouchingCollider;
const float aboveCheckRadius = 0.2f;
void Start()
{
playerRb = GetComponent<Rigidbody2D>();
playerAnim = GetComponent<Animator>();
jumpAction.action.performed += JumpPerformed;
jumpAction.action.canceled += JumpCanceled;
crouchAction.action.performed += CrouchPerformed;
crouchAction.action.canceled += CrouchCanceled;
spinAction.action.performed += SpinPerformed;
brakeAction.action.performed += BrakePerformed;
groundPoundAction.action.performed += GroundPoundPerformed;
bombAction.action.performed += BombPerformed;
danceAction.action.performed += DancePerformed;
danceAction.action.canceled += DanceCanceled;
}
void OnDestroy()
{
// Unsubscribe to prevent memory leaks
jumpAction.action.performed -= JumpPerformed;
jumpAction.action.canceled -= JumpCanceled;
crouchAction.action.performed -= CrouchPerformed;
crouchAction.action.canceled -= CrouchCanceled;
spinAction.action.performed -= SpinPerformed;
brakeAction.action.performed
So I'm trying to make my controls bit smoother for my fast paced 2D platformer, so I'm trying to make it where when you start moving there is a small build up till you get to your normal move speed, and you take some time to slowdown before you come to a stop, help would be appreciated, apologies, I'm still fairly new to game development!
The Whole Player Script:
[Header ("ControllerInput")]
public InputActionReference move;
public InputActionReference jumpAction;
public InputActionReference crouchAction;
public InputActionReference spinAction;
public InputActionReference bombAction;
public InputActionReference brakeAction;
public InputActionReference groundPoundAction;
public InputActionReference danceAction;
[Header ("Particles")]
public ParticleSystem danceParticle;
[Header("Floats And Bools")]
public float moveSpeed = 5f;
public float jumpForce = 3f;
public float wallJumpForce = 2f;
public float shortJumpMultiplier = 0.5f;
public float decelerationFactor = 0.1f;
public float minSpeed = 0.1f;
public bool canJump;
public bool spin;
public bool dive;
public bool slam;
public bool slamCancel;
public bool canWallBounce;
public bool bumped;
public bool rolling;
public bool landAnimation;
public bool facingLeft;
public bool freeMove;
public bool walk;
public bool blasted;
public bool dance;
public bool wallWalk;
public bool ceilingAbove;
public bool canDash = true;
public bool isDashing;
public bool jumpCanceled;
public bool canDiveBomb;
public bool diveBombed;
public bool spinDive;
[Header("Dash Speeds")]
public bool dash1;
public bool dash2;
public bool dash3;
public bool dash4;
[Header("Dash Timer")]
public float idleThreshold = 3f;
private float idleTime = 0f;
[Header("Layers And Transforms")]
public Transform groundCheck;
public Transform ceilingCheck;
public LayerMask groundLayer;
public LayerMask ceilingLayer;
[Header("Private")]
private Rigidbody2D playerRb;
private Animator playerAnim;
private Vector2 moveDirection;
private Vector2 lastDirection;
private bool isJumping;
private bool danceAir;
private float dashingTime = 0.25f;
[SerializeField] bool isBraking = false;
[SerializeField] bool crouching;
[SerializeField] Collider2D standingCollider;
[SerializeField] Collider2D crouchingCollider;
const float aboveCheckRadius = 0.2f;
void Start()
{
playerRb = GetComponent<Rigidbody2D>();
playerAnim = GetComponent<Animator>();
jumpAction.action.performed += JumpPerformed;
jumpAction.action.canceled += JumpCanceled;
crouchAction.action.performed += CrouchPerformed;
crouchAction.action.canceled += CrouchCanceled;
spinAction.action.performed += SpinPerformed;
brakeAction.action.performed += BrakePerformed;
groundPoundAction.action.performed += GroundPoundPerformed;
bombAction.action.performed += BombPerformed;
danceAction.action.performed += DancePerformed;
danceAction.action.canceled += DanceCanceled;
}
void OnDestroy()
{
// Unsubscribe to prevent memory leaks
jumpAction.action.performed -= JumpPerformed;
jumpAction.action.canceled -= JumpCanceled;
crouchAction.action.performed -= CrouchPerformed;
crouchAction.action.canceled -= CrouchCanceled;
spinAction.action.performed -= SpinPerformed;
brakeAction.action.performed
-= BrakePerformed;
groundPoundAction.action.performed -= GroundPoundPerformed;
bombAction.action.performed -= BombPerformed;
danceAction.action.performed -= DancePerformed;
danceAction.action.canceled -= DanceCanceled;
}
void Update()
{
if (isDashing)
{
return;
}
#region MOVEMENT/JUMPING ANIMATIONS
float smoothedVelocityX = Mathf.Lerp(playerAnim.GetFloat("xVelocity"), Mathf.Abs(playerRb.velocity.x), Time.deltaTime * 150f);
playerAnim.SetFloat("xVelocity", smoothedVelocityX);
if (wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", true);
spin = false;
}
else if (!wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", false);
}
if (!dance && isGrounded())
{
playerAnim.SetBool("Dance", false);
}
else if (dance && isGrounded() && !dash1)
{
playerAnim.SetBool("Dance", true);
}
if (isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", true);
danceAir = false;
}
else if (!isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", false);
danceAir = true;
}
bool isJumping = playerRb.velocity.y > 0.1f;
bool isFalling = playerRb.velocity.y < -0.1f;
if (!slam)
{
playerAnim.SetBool("Jump", isJumping);
if (!jumpCanceled)
{
playerAnim.SetBool("Fall", isFalling);
}
}
#endregion
#region WALK/DASH MOVEMENT
Flip();
if (!dive && !isBraking && !rolling && !walk && !dash4)
{
moveDirection = move.action.ReadValue<Vector2>();
}
if (isGrounded())
{
canJump = true;
canWallBounce = true;
slamCancel = false;
canDash = true;
jumpCanceled = false;
diveBombed = false;
spinDive = false;
playerAnim.SetBool("Fall", false);
playerAnim.SetBool("SlamCancel", false);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("Grounded", true);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
StartCoroutine(SlamFallAnimationEnd());
}
else
{
canJump = false;
}
if (!isGrounded())
{
playerAnim.SetBool("Grounded", false);
}
if(isGrounded() && isDashing)
{
isDashing = false;
}
if (!bumped && !dash1 && !isBraking)
{
moveSpeed = 9;
}
if (moveDirection.x == 0f && isGrounded() && !dash4)
{
idleTime += Time.deltaTime;
}
else
{
idleTime = 0f;
}
if (idleTime >= idleThreshold * 4 && dash1 && isGrounded() && !dash4 && !bumped)
{
dash1 = false;
}
else if (idleTime >= idleThreshold * 3 && dash2 && isGrounded() && !dash4 && !bumped)
{
dash2 = false;
}
else if (idleTime >= idleThreshold * 2 && dash3 && isGrounded() && !dash4 && !bumped)
{
dash3 = false;
}
#endregion
#region DASH 4 MOVEMENT
if (!dive && !isBraking && !rolling && !bumped)
{
groundPoundAction.action.performed -= GroundPoundPerformed;
bombAction.action.performed -= BombPerformed;
danceAction.action.performed -= DancePerformed;
danceAction.action.canceled -= DanceCanceled;
}
void Update()
{
if (isDashing)
{
return;
}
#region MOVEMENT/JUMPING ANIMATIONS
float smoothedVelocityX = Mathf.Lerp(playerAnim.GetFloat("xVelocity"), Mathf.Abs(playerRb.velocity.x), Time.deltaTime * 150f);
playerAnim.SetFloat("xVelocity", smoothedVelocityX);
if (wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", true);
spin = false;
}
else if (!wallWalk && isGrounded())
{
playerAnim.SetBool("WallIdle", false);
}
if (!dance && isGrounded())
{
playerAnim.SetBool("Dance", false);
}
else if (dance && isGrounded() && !dash1)
{
playerAnim.SetBool("Dance", true);
}
if (isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", true);
danceAir = false;
}
else if (!isGrounded() && dance)
{
playerAnim.SetBool("DanceGround", false);
danceAir = true;
}
bool isJumping = playerRb.velocity.y > 0.1f;
bool isFalling = playerRb.velocity.y < -0.1f;
if (!slam)
{
playerAnim.SetBool("Jump", isJumping);
if (!jumpCanceled)
{
playerAnim.SetBool("Fall", isFalling);
}
}
#endregion
#region WALK/DASH MOVEMENT
Flip();
if (!dive && !isBraking && !rolling && !walk && !dash4)
{
moveDirection = move.action.ReadValue<Vector2>();
}
if (isGrounded())
{
canJump = true;
canWallBounce = true;
slamCancel = false;
canDash = true;
jumpCanceled = false;
diveBombed = false;
spinDive = false;
playerAnim.SetBool("Fall", false);
playerAnim.SetBool("SlamCancel", false);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("Grounded", true);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
StartCoroutine(SlamFallAnimationEnd());
}
else
{
canJump = false;
}
if (!isGrounded())
{
playerAnim.SetBool("Grounded", false);
}
if(isGrounded() && isDashing)
{
isDashing = false;
}
if (!bumped && !dash1 && !isBraking)
{
moveSpeed = 9;
}
if (moveDirection.x == 0f && isGrounded() && !dash4)
{
idleTime += Time.deltaTime;
}
else
{
idleTime = 0f;
}
if (idleTime >= idleThreshold * 4 && dash1 && isGrounded() && !dash4 && !bumped)
{
dash1 = false;
}
else if (idleTime >= idleThreshold * 3 && dash2 && isGrounded() && !dash4 && !bumped)
{
dash2 = false;
}
else if (idleTime >= idleThreshold * 2 && dash3 && isGrounded() && !dash4 && !bumped)
{
dash3 = false;
}
#endregion
#region DASH 4 MOVEMENT
if (!dive && !isBraking && !rolling && !bumped)
{
moveDirection = move.action.ReadValue<Vector2>();
if (dash4 && !freeMove)
{
if (moveDirection != Vector2.zero)
{
lastDirection = moveDirection;
walk = true;
}
else
{
moveDirection = lastDirection;
walk = false;
}
}
else
{
walk = false;
}
}
if (!dash4)
{
playerRb.velocity = new Vector2(moveDirection.x * moveSpeed, playerRb.velocity.y);
}
else
{
playerRb.velocity = new Vector2(moveDirection.x * moveSpeed, playerRb.velocity.y);
}
if(dash4 && isGrounded())
{
freeMove = false;
}
#endregion
#region BOMB SLAM
if (isGrounded() && slam && !slamCancel && dash4 && dash3 && dash2 && dash1 && !dance)
{
slam = false;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if(isGrounded() && slam && !slamCancel && dash3 && dash2 && dash1 && !dance)
{
slam = false;
dash4 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash2 && dash1 && !dance)
{
slam = false;
dash3 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash1 && !dance)
{
slam = false;
dash2 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && !dash1 && !dance)
{
slam = false;
dash1 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
#endregion
#region BRAKING/SPEED LOGIC
if (isBraking)
{
Dash1Deceleration();
}
else if (!isBraking)
{
if (dash4 && dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 21f;
}
else if (dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 18f;
}
else if (dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 15f;
}
else if (dash1 && !dive && !dance && !bumped)
{
moveSpeed = 12f;
}
else if (!dive &&
if (dash4 && !freeMove)
{
if (moveDirection != Vector2.zero)
{
lastDirection = moveDirection;
walk = true;
}
else
{
moveDirection = lastDirection;
walk = false;
}
}
else
{
walk = false;
}
}
if (!dash4)
{
playerRb.velocity = new Vector2(moveDirection.x * moveSpeed, playerRb.velocity.y);
}
else
{
playerRb.velocity = new Vector2(moveDirection.x * moveSpeed, playerRb.velocity.y);
}
if(dash4 && isGrounded())
{
freeMove = false;
}
#endregion
#region BOMB SLAM
if (isGrounded() && slam && !slamCancel && dash4 && dash3 && dash2 && dash1 && !dance)
{
slam = false;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if(isGrounded() && slam && !slamCancel && dash3 && dash2 && dash1 && !dance)
{
slam = false;
dash4 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash2 && dash1 && !dance)
{
slam = false;
dash3 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && dash1 && !dance)
{
slam = false;
dash2 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
else if (isGrounded() && slam && !slamCancel && !dash1 && !dance)
{
slam = false;
dash1 = true;
playerRb.gravityScale = 3;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamBlast", true);
blasted = true;
diveBombed = false;
playerRb.velocity = new Vector2(0, 19);
}
#endregion
#region BRAKING/SPEED LOGIC
if (isBraking)
{
Dash1Deceleration();
}
else if (!isBraking)
{
if (dash4 && dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 21f;
}
else if (dash3 && dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 18f;
}
else if (dash2 && dash1 && !dive && !dance && !bumped)
{
moveSpeed = 15f;
}
else if (dash1 && !dive && !dance && !bumped)
{
moveSpeed = 12f;
}
else if (!dive &&
!dance && !bumped)
{
moveSpeed = 9;
}
}
#endregion
}
private void FixedUpdate()
{
Crouch(crouching);
if (dive && isGrounded())
{
DiveDeceleration();
}
}
#region CONTROLS
void Flip()
{
if (playerRb.velocity.x < 0 && !facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = true;
transform.Rotate(0f, 180f, 0f);
}
else if (playerRb.velocity.x > 0 && facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = false;
transform.Rotate(0f, 180f, 0f);
}
}
private void JumpPerformed(InputAction.CallbackContext context)
{
if (canJump && !crouching && isGrounded() && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, jumpForce);
}
else if(crouching && canJump && isGrounded() && playerRb.velocity.x == 0 && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, 8);
}
if (slam)
{
playerRb.velocity = new Vector2(0, 14);
playerRb.gravityScale = 3;
slam = false;
slamCancel = true;
freeMove = true;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamCancel", true);
}
#region DIVING
if (crouching && dash1 && dash2 && dash3 && dash4 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && dash3 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
}
#endregion
}
private void
{
moveSpeed = 9;
}
}
#endregion
}
private void FixedUpdate()
{
Crouch(crouching);
if (dive && isGrounded())
{
DiveDeceleration();
}
}
#region CONTROLS
void Flip()
{
if (playerRb.velocity.x < 0 && !facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = true;
transform.Rotate(0f, 180f, 0f);
}
else if (playerRb.velocity.x > 0 && facingLeft && !blasted && !danceAir && !bumped)
{
facingLeft = false;
transform.Rotate(0f, 180f, 0f);
}
}
private void JumpPerformed(InputAction.CallbackContext context)
{
if (canJump && !crouching && isGrounded() && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, jumpForce);
}
else if(crouching && canJump && isGrounded() && playerRb.velocity.x == 0 && !bumped && !isBraking)
{
isJumping = true;
canJump = false;
playerRb.velocity = new Vector2(playerRb.velocity.x, 8);
}
if (slam)
{
playerRb.velocity = new Vector2(0, 14);
playerRb.gravityScale = 3;
slam = false;
slamCancel = true;
freeMove = true;
playerAnim.SetBool("Slam", false);
playerAnim.SetBool("SlamCancel", true);
}
#region DIVING
if (crouching && dash1 && dash2 && dash3 && dash4 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 31;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && dash3 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 23;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && dash2 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 20;
playerRb.velocity = new Vector2(0, 6);
}
}
else if (crouching && dash1 && isGrounded() && canJump && !bumped)
{
if (playerRb.velocity.x > 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
else if (playerRb.velocity.x < 0)
{
dive = true;
moveSpeed = 18;
playerRb.velocity = new Vector2(0, 6);
}
}
#endregion
}
private void
JumpCanceled(InputAction.CallbackContext context)
{
jumpCanceled = true;
if (isJumping && canWallBounce && !bumped && !blasted)
{
if (playerRb.velocity.y > 0)
{
playerRb.velocity = new Vector2(playerRb.velocity.x, playerRb.velocity.y * shortJumpMultiplier);
}
isJumping = false;
}
}
private bool isGrounded()
{
return Physics2D.OverlapCapsule(groundCheck.position, new Vector2(0.5f, 0.1f), CapsuleDirection2D.Horizontal, 0, groundLayer);
}
private void BombPerformed(InputAction.CallbackContext context)
{
#region DIVEBOOST
if (canJump && dive && dash4 && dash3 && dash2 && dash1)
{
dive = false;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash3 && dash2 && dash1)
{
dive = false;
dash4 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash2 && dash1)
{
dive = false;
dash3 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash1)
{
dive = false;
dash2 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
#endregion
if (canDiveBomb && dash1 && dash2 && dash3 && dash4)
{
isDashing = false;
diveBombed = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && dash2 && dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash4 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash3 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && !dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash2 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && !dash1 && !dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash1 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
if (!isGrounded() && !slam && !slamCancel && !blasted && !dance && spinDive)
{
slam = true;
freeMove = true;
isDashing = false;
spinDive = false;
playerAnim.SetBool("Slam", true);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
playerRb.gravityScale = 2.5f;
playerRb.velocity = new Vector2(0, 9.5f);
{
jumpCanceled = true;
if (isJumping && canWallBounce && !bumped && !blasted)
{
if (playerRb.velocity.y > 0)
{
playerRb.velocity = new Vector2(playerRb.velocity.x, playerRb.velocity.y * shortJumpMultiplier);
}
isJumping = false;
}
}
private bool isGrounded()
{
return Physics2D.OverlapCapsule(groundCheck.position, new Vector2(0.5f, 0.1f), CapsuleDirection2D.Horizontal, 0, groundLayer);
}
private void BombPerformed(InputAction.CallbackContext context)
{
#region DIVEBOOST
if (canJump && dive && dash4 && dash3 && dash2 && dash1)
{
dive = false;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash3 && dash2 && dash1)
{
dive = false;
dash4 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash2 && dash1)
{
dive = false;
dash3 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
else if (canJump && dive && dash1)
{
dive = false;
dash2 = true;
playerRb.gravityScale = 3;
playerRb.velocity = new Vector2(0, 13);
}
#endregion
if (canDiveBomb && dash1 && dash2 && dash3 && dash4)
{
isDashing = false;
diveBombed = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && dash2 && dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash4 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash3 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && dash1 && !dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash2 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
else if (canDiveBomb && !dash1 && !dash2 && !dash3 && !dash4)
{
isDashing = false;
diveBombed = true;
dash1 = true;
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", true);
playerRb.velocity = new Vector2(0, 18);
}
if (!isGrounded() && !slam && !slamCancel && !blasted && !dance && spinDive)
{
slam = true;
freeMove = true;
isDashing = false;
spinDive = false;
playerAnim.SetBool("Slam", true);
playerAnim.SetBool("Dash", false);
playerAnim.SetBool("DashBlast", false);
playerAnim.SetBool("SpinDive", false);
playerRb.gravityScale = 2.5f;
playerRb.velocity = new Vector2(0, 9.5f);
StartCoroutine(SlamFall());
}
}
IEnumerator SlamFall()
{
yield return new WaitForSeconds(0.23f);
if (slam && !slamCancel)
{
playerRb.gravityScale = 5f;
}
}
IEnumerator SlamFallAnimationEnd()
{
yield return new WaitForSeconds(0.02f);
if (isGrounded())
{
playerAnim.SetBool("SlamBlast", false);
blasted = false;
}
}
private void DancePerformed(InputAction.CallbackContext context)
{
if (!dash1 && isGrounded() && !bumped)
{
dance = true;
danceParticle.Play();
}
}
private void DanceCanceled(InputAction.CallbackContext context)
{
dance = false;
danceAir = false;
danceParticle.Stop();
}
private void CrouchPerformed(InputAction.CallbackContext context)
{
if (isGrounded() && !dance && !bumped)
{
crouching = true;
spin = false;
playerAnim.SetBool("Crouch", true);
playerAnim.SetBool("Spin", false);
}
if (!slam && playerRb.velocity.x > 0 && crouching && dash1 && !bumped)
{
transform.Translate(Vector2.right * moveSpeed * Time.deltaTime);
rolling = true;
}
else if (!slam && playerRb.velocity.x < 0 && crouching && dash1)
{
transform.Translate(Vector2.left * moveSpeed * Time.deltaTime);
rolling = true;
}
if(!isGrounded() && !dance && !slam && !blasted)
{
playerRb.velocity = new Vector2(playerRb.velocity.x, -13f);
spinDive = true;
isDashing = false;
playerAnim.SetBool("SpinDive", true);
}
}
private void CrouchCanceled(InputAction.CallbackContext context)
{
crouching = false;
if (!slam && playerRb.velocity.x > 0 && dash1)
{
rolling = false;
}
else if (!slam && playerRb.velocity.x < 0 && dash1)
{
rolling = false;
}
}
void Crouch(bool crouchFlag)
{
if (!crouchFlag)
{
if (Physics2D.OverlapCircle(ceilingCheck.position, aboveCheckRadius, ceilingLayer))
{
crouchFlag = true;
}
}
if (!crouchFlag)
{
playerAnim.SetBool("Crouch", false);
rolling = false;
}
else
{
playerAnim.SetBool("Crouch", true);
}
standingCollider.enabled = !crouchFlag;
crouchingCollider.enabled = crouchFlag;
if (Physics2D.OverlapCircle(ceilingCheck.position, aboveCheckRadius, ceilingLayer))
{
ceilingAbove = true;
}
else if (!Physics2D.OverlapCircle(ceilingCheck.position, aboveCheckRadius, ceilingLayer))
{
StartCoroutine(AboveCheckStop());
}
}
IEnumerator AboveCheckStop()
{
yield return new WaitForSeconds(0.1f);
ceilingAbove = false;
}
private void DiveDeceleration()
{
if (moveSpeed > minSpeed)
{
moveSpeed -= decelerationFactor;
}
else
{
moveSpeed = 0;
dive = false;
}
}
private void SpinPerformed(InputAction.CallbackContext context)
{
if (!spin && !dive && !crouching && !slam && !slamCancel && canWallBounce && !dance && !bumped && !wallWalk && isGrounded())
}
}
IEnumerator SlamFall()
{
yield return new WaitForSeconds(0.23f);
if (slam && !slamCancel)
{
playerRb.gravityScale = 5f;
}
}
IEnumerator SlamFallAnimationEnd()
{
yield return new WaitForSeconds(0.02f);
if (isGrounded())
{
playerAnim.SetBool("SlamBlast", false);
blasted = false;
}
}
private void DancePerformed(InputAction.CallbackContext context)
{
if (!dash1 && isGrounded() && !bumped)
{
dance = true;
danceParticle.Play();
}
}
private void DanceCanceled(InputAction.CallbackContext context)
{
dance = false;
danceAir = false;
danceParticle.Stop();
}
private void CrouchPerformed(InputAction.CallbackContext context)
{
if (isGrounded() && !dance && !bumped)
{
crouching = true;
spin = false;
playerAnim.SetBool("Crouch", true);
playerAnim.SetBool("Spin", false);
}
if (!slam && playerRb.velocity.x > 0 && crouching && dash1 && !bumped)
{
transform.Translate(Vector2.right * moveSpeed * Time.deltaTime);
rolling = true;
}
else if (!slam && playerRb.velocity.x < 0 && crouching && dash1)
{
transform.Translate(Vector2.left * moveSpeed * Time.deltaTime);
rolling = true;
}
if(!isGrounded() && !dance && !slam && !blasted)
{
playerRb.velocity = new Vector2(playerRb.velocity.x, -13f);
spinDive = true;
isDashing = false;
playerAnim.SetBool("SpinDive", true);
}
}
private void CrouchCanceled(InputAction.CallbackContext context)
{
crouching = false;
if (!slam && playerRb.velocity.x > 0 && dash1)
{
rolling = false;
}
else if (!slam && playerRb.velocity.x < 0 && dash1)
{
rolling = false;
}
}
void Crouch(bool crouchFlag)
{
if (!crouchFlag)
{
if (Physics2D.OverlapCircle(ceilingCheck.position, aboveCheckRadius, ceilingLayer))
{
crouchFlag = true;
}
}
if (!crouchFlag)
{
playerAnim.SetBool("Crouch", false);
rolling = false;
}
else
{
playerAnim.SetBool("Crouch", true);
}
standingCollider.enabled = !crouchFlag;
crouchingCollider.enabled = crouchFlag;
if (Physics2D.OverlapCircle(ceilingCheck.position, aboveCheckRadius, ceilingLayer))
{
ceilingAbove = true;
}
else if (!Physics2D.OverlapCircle(ceilingCheck.position, aboveCheckRadius, ceilingLayer))
{
StartCoroutine(AboveCheckStop());
}
}
IEnumerator AboveCheckStop()
{
yield return new WaitForSeconds(0.1f);
ceilingAbove = false;
}
private void DiveDeceleration()
{
if (moveSpeed > minSpeed)
{
moveSpeed -= decelerationFactor;
}
else
{
moveSpeed = 0;
dive = false;
}
}
private void SpinPerformed(InputAction.CallbackContext context)
{
if (!spin && !dive && !crouching && !slam && !slamCancel && canWallBounce && !dance && !bumped && !wallWalk && isGrounded())
{
spin = true;
dash1 = true;
playerAnim.SetBool("Spin", true);
StartCoroutine(SpinCancel());
}
if(!isGrounded() && !spin && !dive && !crouching && !slamCancel && !dance && !bumped && !blasted && !wallWalk && canDash)
{
if (slam)
{
playerAnim.SetBool("Slam", false);
slam = false;
playerRb.gravityScale = 3;
}
playerAnim.SetBool("Dash", true);
playerAnim.SetBool("SpinDive", false);
StartCoroutine(Dash());
}
}
IEnumerator SpinCancel()
{
yield return new WaitForSeconds(0.5f);
playerAnim.SetBool("Spin", false);
spin = false;
}
#region DASHSTUFF
IEnumerator Dash()
{
canDash = false;
spinDive = false;
isDashing = true;
canDiveBomb = true;
StartCoroutine(DiveBomb());
Vector2 originalVelocity = playerRb.velocity;
if (!facingLeft && !dash1 && !dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 19, 7f);
}
else if (facingLeft && !dash1 && !dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -19, 7f);
}
else if (!facingLeft && dash1 && !dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 21, 7f);
}
else if (facingLeft && dash1 && !dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -21, 7f);
}
else if (!facingLeft && dash1 && dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 25, 7f);
}
else if (facingLeft && dash1 && dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -25, 7f);
}
else if (!facingLeft && dash1 && dash2 && dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 28, 7f);
}
else if (facingLeft && dash1 && dash2 && dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -28, 7f);
}
else if (!facingLeft && dash1 && dash2 && dash3 && dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 31, 7f);
}
else if (facingLeft && dash1 && dash2 && dash3 && dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -31, 7f);
}
yield return new WaitForSeconds(dashingTime);
isDashing = false;
if (!isGrounded() && !slam && !slamCancel && !diveBombed && !spinDive)
{
float timeElapsed = 0f;
float slowdownDuration = 0.3f;
float startXVelocity = playerRb.velocity.x;
while (timeElapsed < slowdownDuration)
{
playerRb.velocity = new Vector2(Mathf.Lerp(startXVelocity, originalVelocity.x, timeElapsed / slowdownDuration), playerRb.velocity.y);
timeElapsed += Time.deltaTime;
yield return null;
}
playerRb.velocity = new Vector2(originalVelocity.x, playerRb.velocity.y);
}
else if(isGrounded() && isDashing)
{
isDashing = false;
}
}
IEnumerator DiveBomb()
{
yield return new WaitForSeconds(0.4f);
canDiveBomb = false;
}
#endregion
private void
spin = true;
dash1 = true;
playerAnim.SetBool("Spin", true);
StartCoroutine(SpinCancel());
}
if(!isGrounded() && !spin && !dive && !crouching && !slamCancel && !dance && !bumped && !blasted && !wallWalk && canDash)
{
if (slam)
{
playerAnim.SetBool("Slam", false);
slam = false;
playerRb.gravityScale = 3;
}
playerAnim.SetBool("Dash", true);
playerAnim.SetBool("SpinDive", false);
StartCoroutine(Dash());
}
}
IEnumerator SpinCancel()
{
yield return new WaitForSeconds(0.5f);
playerAnim.SetBool("Spin", false);
spin = false;
}
#region DASHSTUFF
IEnumerator Dash()
{
canDash = false;
spinDive = false;
isDashing = true;
canDiveBomb = true;
StartCoroutine(DiveBomb());
Vector2 originalVelocity = playerRb.velocity;
if (!facingLeft && !dash1 && !dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 19, 7f);
}
else if (facingLeft && !dash1 && !dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -19, 7f);
}
else if (!facingLeft && dash1 && !dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 21, 7f);
}
else if (facingLeft && dash1 && !dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -21, 7f);
}
else if (!facingLeft && dash1 && dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 25, 7f);
}
else if (facingLeft && dash1 && dash2 && !dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -25, 7f);
}
else if (!facingLeft && dash1 && dash2 && dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 28, 7f);
}
else if (facingLeft && dash1 && dash2 && dash3 && !dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -28, 7f);
}
else if (!facingLeft && dash1 && dash2 && dash3 && dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * 31, 7f);
}
else if (facingLeft && dash1 && dash2 && dash3 && dash4)
{
playerRb.velocity = new Vector2(transform.localScale.x * -31, 7f);
}
yield return new WaitForSeconds(dashingTime);
isDashing = false;
if (!isGrounded() && !slam && !slamCancel && !diveBombed && !spinDive)
{
float timeElapsed = 0f;
float slowdownDuration = 0.3f;
float startXVelocity = playerRb.velocity.x;
while (timeElapsed < slowdownDuration)
{
playerRb.velocity = new Vector2(Mathf.Lerp(startXVelocity, originalVelocity.x, timeElapsed / slowdownDuration), playerRb.velocity.y);
timeElapsed += Time.deltaTime;
yield return null;
}
playerRb.velocity = new Vector2(originalVelocity.x, playerRb.velocity.y);
}
else if(isGrounded() && isDashing)
{
isDashing = false;
}
}
IEnumerator DiveBomb()
{
yield return new WaitForSeconds(0.4f);
canDiveBomb = false;
}
#endregion
private void
BrakePerformed(InputAction.CallbackContext context)
{
if (playerRb.velocity.x > 0 && !isBraking && !dive && !crouching && !dance && isGrounded() && !bumped && !wallWalk)
{
isBraking = true;
dash1 = false;
playerAnim.SetBool("Brake", true);
}
else if (playerRb.velocity.x < 0 && !isBraking && !dive && !crouching && !dance && isGrounded() && !bumped && !wallWalk)
{
isBraking = true;
dash1 = false;
playerAnim.SetBool("Brake", true);
}
}
private void Dash1Deceleration()
{
if (moveSpeed > 0)
{
moveSpeed -= decelerationFactor * 25f * Time.deltaTime; // Decrease speed gradually
moveSpeed = Mathf.Max(moveSpeed, 0); // Clamp speed
}
else
{
moveSpeed = 0;
isBraking = false;
dash1 = false;
dash2 = false;
dash3 = false;
dash4 = false;
playerAnim.SetBool("Brake", false);
}
}
#endregion
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Wall") && !isGrounded() && canWallBounce && !slam && dash1 && !bumped)
{
playerRb.velocity = new Vector2(0f, 18f);
canWallBounce = false;
dive = false;
canJump = false;
freeMove = true;
}
if (collision.gameObject.CompareTag("Wall") && dash1 && isGrounded() && canJump && !ceilingAbove || collision.gameObject.layer == 6 && dash1 && isGrounded() && canJump && !ceilingAbove)
{
moveSpeed = 0;
bumped = true;
crouching = false;
playerAnim.SetBool("Bump", true);
StartCoroutine(WallDeceleration());
}
if(collision.gameObject.CompareTag("Wall") && !dash1 && isGrounded() && !ceilingAbove || collision.gameObject.layer == 6 && !dash1 && isGrounded() && !ceilingAbove)
{
wallWalk = true;
isBraking = false;
playerAnim.SetBool("Brake", false);
}
}
private void OnCollisionExit2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Wall") && !bumped && isGrounded() || collision.gameObject.layer == 6 && !bumped && isGrounded())
{
wallWalk = false;
}
}
IEnumerator WallDeceleration()
{
yield return new WaitForSeconds(0.40f);
moveSpeed = 7;
dash1 = false;
dash2 = false;
dash3 = false;
dash4 = false;
bumped = false;
playerAnim.SetBool("Bump", false);
}
https://redd.it/1i11lf8
@r_Unity3D
{
if (playerRb.velocity.x > 0 && !isBraking && !dive && !crouching && !dance && isGrounded() && !bumped && !wallWalk)
{
isBraking = true;
dash1 = false;
playerAnim.SetBool("Brake", true);
}
else if (playerRb.velocity.x < 0 && !isBraking && !dive && !crouching && !dance && isGrounded() && !bumped && !wallWalk)
{
isBraking = true;
dash1 = false;
playerAnim.SetBool("Brake", true);
}
}
private void Dash1Deceleration()
{
if (moveSpeed > 0)
{
moveSpeed -= decelerationFactor * 25f * Time.deltaTime; // Decrease speed gradually
moveSpeed = Mathf.Max(moveSpeed, 0); // Clamp speed
}
else
{
moveSpeed = 0;
isBraking = false;
dash1 = false;
dash2 = false;
dash3 = false;
dash4 = false;
playerAnim.SetBool("Brake", false);
}
}
#endregion
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Wall") && !isGrounded() && canWallBounce && !slam && dash1 && !bumped)
{
playerRb.velocity = new Vector2(0f, 18f);
canWallBounce = false;
dive = false;
canJump = false;
freeMove = true;
}
if (collision.gameObject.CompareTag("Wall") && dash1 && isGrounded() && canJump && !ceilingAbove || collision.gameObject.layer == 6 && dash1 && isGrounded() && canJump && !ceilingAbove)
{
moveSpeed = 0;
bumped = true;
crouching = false;
playerAnim.SetBool("Bump", true);
StartCoroutine(WallDeceleration());
}
if(collision.gameObject.CompareTag("Wall") && !dash1 && isGrounded() && !ceilingAbove || collision.gameObject.layer == 6 && !dash1 && isGrounded() && !ceilingAbove)
{
wallWalk = true;
isBraking = false;
playerAnim.SetBool("Brake", false);
}
}
private void OnCollisionExit2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Wall") && !bumped && isGrounded() || collision.gameObject.layer == 6 && !bumped && isGrounded())
{
wallWalk = false;
}
}
IEnumerator WallDeceleration()
{
yield return new WaitForSeconds(0.40f);
moveSpeed = 7;
dash1 = false;
dash2 = false;
dash3 = false;
dash4 = false;
bumped = false;
playerAnim.SetBool("Bump", false);
}
https://redd.it/1i11lf8
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Put a slow down enemy movement feature
Does any know how or a video on how to add a game object that slows down the enemy speed only for a moment?
https://redd.it/1i13tff
@r_Unity3D
Does any know how or a video on how to add a game object that slows down the enemy speed only for a moment?
https://redd.it/1i13tff
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Unity 6 – ready to use, or too early. Discuss?
Has anyone upgraded to Unity 6? If so, have you had any issues? Have you explored features like the UI Toolkit, Unity Sentis, or the new lighting? I started learning on a previous version of Unity and am now trying to decide which version to use when I begin prototyping my games.
https://redd.it/1i1555g
@r_Unity3D
Has anyone upgraded to Unity 6? If so, have you had any issues? Have you explored features like the UI Toolkit, Unity Sentis, or the new lighting? I started learning on a previous version of Unity and am now trying to decide which version to use when I begin prototyping my games.
https://redd.it/1i1555g
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community