@rapid moss, your codeblock was automatically pasted to https://paste.myst.rs/vl30u7c3
a powerful website for storing and sharing text and code snippets. completely free and open source.
1 messages · Page 1 of 1 (latest)
@rapid moss, your codeblock was automatically pasted to https://paste.myst.rs/vl30u7c3
a powerful website for storing and sharing text and code snippets. completely free and open source.
private void MyInput()
{
//Input
horizontalInput = Input.GetAxis("Horizontal");
verticalInput = Input.GetAxis("Vertical");
//Direction
moveDirection = orientation.forward * verticalInput + orientation.right * horizontalInput;
//Jump
if (Input.GetKey(jumpKey) && grounded && readyToJump)
{
Jump();
readyToJump = false;
Invoke(nameof(ResetJump), jumpCooldown);
}
//Quickdash
if (Input.GetKey(quickdashKey) && readyToQuickdash)
{
Quickdash();
readyToQuickdash = false;
Invoke(nameof(ResetQuickdash), quickdashCooldown);
}
}
private void Jump()
{ //reset y velocity
rb.linearVelocity = new Vector3(rb.linearVelocity.x, 0f, rb.linearVelocity.z);
rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}
private void ResetJump()
{
readyToJump = true;
}
private void Quickdash()
{
rb.linearVelocity = new Vector3(rb.linearVelocity.x, 0f, rb.linearVelocity.z);
rb.AddForce(transform.forward * quickdashspeed, ForceMode.Impulse);
}
private void ResetQuickdash()
{
readyToQuickdash = true;
}
}