aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-19 05:14:57 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-19 05:14:57 +0100
commit6805c6db39c1a9409b39aaf601f78db92b684c0d (patch)
tree2f9657d97c3b188a82c07cf228c9def712223414 /src/client.rs
parentee2bc9dca88e52b92a49a9ff21db8832b3b66255 (diff)
feat: pull ability
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs
index 22e3960..1768b2e 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -445,6 +445,30 @@ fn gizmos_attack_indicator(
);
gizmos.arrow_2d(position.0, dash_end, Color::YELLOW);
}
+ Ability::Directional(DirectionalAbility::Pull) => {
+ let Some(world_position) = cursor_world_position(&windows, &cameras) else {
+ return;
+ };
+ let Some(direction) = (world_position - position.0).try_normalize() else {
+ return;
+ };
+ let Some((_, pull_start, pull_end)) = pull_collision(
+ PlayerId(client_id.0),
+ position.0,
+ direction,
+ 150.,
+ &player_positions,
+ ) else {
+ let pull_direction = -150. * direction;
+ let pull_start = position.0 - pull_direction;
+ let pull_end = pull_start
+ + (pull_direction.length() - 2. * PLAYER_RADIUS)
+ * pull_direction.normalize_or_zero();
+ gizmos.arrow_2d(pull_start, pull_end, Color::YELLOW);
+ return;
+ };
+ gizmos.arrow_2d(pull_start, pull_end, Color::YELLOW);
+ }
Ability::Directional(_) => {
let Some(world_position) = cursor_world_position(&windows, &cameras) else {
return;