A team game with an emphasis on movement (with no shooting), inspired by Overwatch and Zineth
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
946 B

  1. extends "res://scripts/player.gd"
  2. const wallride_speed = 0
  3. const wallride_speed_necessary = 15
  4. const wallride_leap_height = 10
  5. const wallride_leap_side = 10
  6. var since_on_wall = 0
  7. var last_wall_normal = Vector3()
  8. var wallride_forgiveness = .150
  9. func control_player(delta):
  10. wallride(delta)
  11. .control_player(delta)
  12. func wallride(delta):
  13. # If our feet aren't touching, but we are colliding, we are wall-riding
  14. if is_on_wall() and not is_on_floor() and velocity.length() > wallride_speed_necessary:
  15. since_on_wall = 0
  16. last_wall_normal = get_slide_collision(0).normal
  17. else:
  18. since_on_wall += delta
  19. if since_on_wall < wallride_forgiveness:
  20. var aim = get_node("Yaw").get_global_transform().basis
  21. # Add zero gravity
  22. velocity.y = -gravity # So it's undone in super
  23. # Allow jumping (for wall hopping!)
  24. if Input.is_action_just_pressed("jump"):
  25. velocity.y += wallride_leap_height
  26. velocity += wallride_leap_side * last_wall_normal