Keyboard controls:
Player 1: extend: Q shrink: E Swing: R Player 2: extend: . shrink: , swing: L
This commit is contained in:
parent
98421cb784
commit
f582ea491a
|
@ -32,6 +32,9 @@ public class PlayerInput : MonoBehaviour
|
|||
|
||||
private void Update()
|
||||
{
|
||||
// check in update to switch if controller is connected/disconnected mid game
|
||||
controller = Gamepad.all.ElementAtOrDefault(playerNumber);
|
||||
|
||||
if (controller != null)
|
||||
{
|
||||
movement.x = controller.leftStick.x.ReadValue();
|
||||
|
@ -47,18 +50,29 @@ public class PlayerInput : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
// wasd
|
||||
if (!useArrowKeys)
|
||||
{
|
||||
movement.x = Input.GetAxisRaw("bruh");
|
||||
movement.y = Input.GetAxisRaw("bruh_v");
|
||||
|
||||
whipAttack = Input.GetKey(KeyCode.R);
|
||||
|
||||
if (Input.GetKey(KeyCode.E)) ropeLengthShrinken?.Invoke(playerNumber);
|
||||
if (Input.GetKey(KeyCode.Q)) ropeLengthExtend?.Invoke(playerNumber);
|
||||
}
|
||||
// arrows keys
|
||||
else
|
||||
{
|
||||
movement.x = Input.GetAxisRaw("bruh2");
|
||||
movement.y = Input.GetAxisRaw("bruh2_v");
|
||||
|
||||
whipAttack = Input.GetKey(KeyCode.L);
|
||||
|
||||
if (Input.GetKey(KeyCode.Comma)) ropeLengthShrinken?.Invoke(playerNumber);
|
||||
if (Input.GetKey(KeyCode.Period)) ropeLengthExtend?.Invoke(playerNumber);
|
||||
|
||||
}
|
||||
whipAttack = Input.GetKey(KeyCode.B);
|
||||
//Debug.Log($"player {playerNumber}: move {movement}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,11 +88,9 @@ public class PlayerMovement : MonoBehaviour
|
|||
{
|
||||
if (collision.collider.gameObject.CompareTag("Enemy"))
|
||||
{ // Other object is an enemy
|
||||
if (whipAttack.IsBeingWhipped && rb.velocity.magnitude > attack.speedYouNeedToNotTakeDamageFromRammingOrSomtmh) {
|
||||
// collision.collider.gameObject.GetComponent<HealthComponent>().TakeDamage(rb.velocity.magnitude * whipSmashDamageMult);
|
||||
} else {
|
||||
hp.TakeDamage(1f);
|
||||
}
|
||||
|
||||
hp.TakeDamage(1f);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue