How easy is it to create space physics?
I kind of want to make a game with a character that is affected by space physics.
For example, zero gravity, equal and opposite reaction. So for instance, the character would continue to float and move in a direction when thrust occurs, unless you use an object or ability to reduce your speed or stop yourself with an equal force.
I'd also like the ability for objects etc that hit my character to cause the character to spin etc.
How complex would this be in terms of coding, or could I do it with built in Unity Engine options.
https://redd.it/1i0czdy
@r_Unity3D
I kind of want to make a game with a character that is affected by space physics.
For example, zero gravity, equal and opposite reaction. So for instance, the character would continue to float and move in a direction when thrust occurs, unless you use an object or ability to reduce your speed or stop yourself with an equal force.
I'd also like the ability for objects etc that hit my character to cause the character to spin etc.
How complex would this be in terms of coding, or could I do it with built in Unity Engine options.
https://redd.it/1i0czdy
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
This media is not supported in your browser
VIEW IN TELEGRAM
Low poly assets for a game with a "Spirited Away" vibe. Your opinion?
https://redd.it/1i0cewc
@r_Unity3D
https://redd.it/1i0cewc
@r_Unity3D
First Look at Pao Pao: We're working on a game about cats who cook! Check out the visuals of the map so far and share your thoughts. Stay tuned for more updates and progress on our Discord: ArtDock! We’d love to hear your thoughts!
https://redd.it/1i0frku
@r_Unity3D
https://redd.it/1i0frku
@r_Unity3D
Make 2D Objects teleport
How do I make 2D Object that spawns, teleport within a Collider zone certain brief time gaps and stays within that Collider zone.
https://redd.it/1i0h1k7
@r_Unity3D
How do I make 2D Object that spawns, teleport within a Collider zone certain brief time gaps and stays within that Collider zone.
https://redd.it/1i0h1k7
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Tilemap Chunking video: free asset
This video demos and explains the new free Tilemap chunking system included in the free TilePlus Toolkit asset.
Lots more detail on the asset store page: fully supported and in active development. This system is free and will always remain so.
Asset Store link (FREE asset)
Chunking video (YT)
https://redd.it/1i0gecl
@r_Unity3D
This video demos and explains the new free Tilemap chunking system included in the free TilePlus Toolkit asset.
Lots more detail on the asset store page: fully supported and in active development. This system is free and will always remain so.
Asset Store link (FREE asset)
Chunking video (YT)
https://redd.it/1i0gecl
@r_Unity3D
Unity Asset Store
TilePlus Painter and TilePlus Toolkit | Sprite Management | Unity Asset Store
Get the TilePlus Painter and TilePlus Toolkit package from CompulsiveCoder and speed up your game development process. Find this & other Sprite Management options on the Unity Asset Store.
After 4 years, I’m finally announcing the demo for my game on steam!
https://www.youtube.com/watch?v=c--eVgNKEnQ
https://redd.it/1i0j4fp
@r_Unity3D
https://www.youtube.com/watch?v=c--eVgNKEnQ
https://redd.it/1i0j4fp
@r_Unity3D
YouTube
Disastory - Official Demo Announcement Trailer
Disastory is an illustrated choice-driven roleplaying adventure where coffee machines find love and teenage girls steal eyeballs! Explore a vibrant world with absurd stories and characters.
Steam:
https://store.steampowered.com/app/3395240/Disastory_Demo/…
Steam:
https://store.steampowered.com/app/3395240/Disastory_Demo/…
My First Video for the 99% of Indie Games Club is Here! ❤️
Hey everyone,
Huge thanks to the mods for letting me post this, and I promise it’ll be my last one about this channel! 🙏
My first video for the 99% of Indie Games Club is finally live! 🎉 I did a review on Mighty Marbles, a physics-based puzzle game that’s both super fun and seriously rage-inducing. The dev shared some great insights into their process, and I had a blast putting the video together.
Check it out here: https://youtu.be/S7Tza4r\_CLo
I’d love to hear your thoughts—whether it’s about the video, the game, or even what I can improve. This channel’s all about showcasing the indie gems that deserve more love, and your feedback will help me make it better.
Thank you again for the support—over 100 subs before a single video was wild. You all are amazing. 💕
Hope you enjoy the video, and maybe discover a new favorite game along the way!
https://redd.it/1i0m5lv
@r_Unity3D
Hey everyone,
Huge thanks to the mods for letting me post this, and I promise it’ll be my last one about this channel! 🙏
My first video for the 99% of Indie Games Club is finally live! 🎉 I did a review on Mighty Marbles, a physics-based puzzle game that’s both super fun and seriously rage-inducing. The dev shared some great insights into their process, and I had a blast putting the video together.
Check it out here: https://youtu.be/S7Tza4r\_CLo
I’d love to hear your thoughts—whether it’s about the video, the game, or even what I can improve. This channel’s all about showcasing the indie gems that deserve more love, and your feedback will help me make it better.
Thank you again for the support—over 100 subs before a single video was wild. You all are amazing. 💕
Hope you enjoy the video, and maybe discover a new favorite game along the way!
https://redd.it/1i0m5lv
@r_Unity3D
YouTube
This Marble Game Made Me Rage Quit… But I Loved It Anyway!
🎥 Welcome to The Hoard Workshop! 🏗️
In this video, I take a deep dive into Mighty Marbles, a physics-based puzzle game with unique mechanics and a colorful, toy-inspired world. What starts as a cozy marble-rolling game quickly turns into a rage-inducing…
In this video, I take a deep dive into Mighty Marbles, a physics-based puzzle game with unique mechanics and a colorful, toy-inspired world. What starts as a cozy marble-rolling game quickly turns into a rage-inducing…
A YouTuber made a video review of my game!
https://www.youtube.com/watch?v=0hJeDdq2w_E
https://redd.it/1i0nlog
@r_Unity3D
https://www.youtube.com/watch?v=0hJeDdq2w_E
https://redd.it/1i0nlog
@r_Unity3D
YouTube
rocket cave adventure is all I need from a game - Review
Rocket. Cave. Adventure. This game was really refreshing and fun.
Gameplay & Video editing by me, Habbu. Voice-over by Dylan.
In this video, I basically just say anything I want to say about the game. It's is and also isn't a review at the same time. I point…
Gameplay & Video editing by me, Habbu. Voice-over by Dylan.
In this video, I basically just say anything I want to say about the game. It's is and also isn't a review at the same time. I point…
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 &&