diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-19 20:28:23 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-19 20:41:40 +0200 |
commit | 8b32c50e1bb2b8c8b00105c13c31b896ebab7f8a (patch) | |
tree | f7de760ddb188518ac278275b6b19ff596949bac | |
parent | 6d7c0cba31aabfeb5d4036e7ab12a39743ba1e6a (diff) | |
download | hurrycurry-8b32c50e1bb2b8c8b00105c13c31b896ebab7f8a.tar hurrycurry-8b32c50e1bb2b8c8b00105c13c31b896ebab7f8a.tar.bz2 hurrycurry-8b32c50e1bb2b8c8b00105c13c31b896ebab7f8a.tar.zst |
Reapply "draft for accessible movement"
This reverts commit 153e778d7d7085d699cf98da38a1196e5e81331a.
-rw-r--r-- | client/player/controllable_player.gd | 22 | ||||
-rw-r--r-- | client/settings.gd | 1 | ||||
-rw-r--r-- | locale/en.ini | 1 |
3 files changed, 18 insertions, 6 deletions
diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd index 142d5f47..9e7ce2b2 100644 --- a/client/player/controllable_player.gd +++ b/client/player/controllable_player.gd @@ -58,10 +58,11 @@ func _process(delta): super(delta) update_touch_scrolls() +var moving_duration = 0 func _process_movement(delta): var input = Input.get_vector("left", "right", "forwards", "backwards") if is_input_enabled() else Vector2.ZERO var boost = Input.is_action_pressed("boost") or (Global.get_setting("gameplay.latch_boost") and boosting) - input = input.rotated( - game.camera.angle_target) + input = input.rotated(-game.camera.angle_target) if Input.is_action_pressed("interact") or Input.is_action_just_released("interact"): input *= 0 else: @@ -69,6 +70,13 @@ func _process_movement(delta): int(floor(movement_base.position.x + sin(movement_base.rotation.y))), int(floor(movement_base.position.z + cos(movement_base.rotation.y))) ) + + if Global.get_setting("gameplay.accessible_movement"): + if input.length() < 0.5: moving_duration -= delta * 2 + else: moving_duration += delta + moving_duration = clamp(moving_duration, 0, 1) + input *= min(1, moving_duration) + interact() var was_boosting = boosting direction = input @@ -81,8 +89,10 @@ func _process_movement(delta): func update(dt: float, boost: bool): direction = direction.limit_length(1.); - if direction.length() > 0.1: - self.facing = direction + (self.facing - direction) * exp( - dt * 10.) + if direction.length() > 0.05: + self.facing = direction + (self.facing - direction) * exp(-dt * 10.) + if direction.length() < 0.5: + direction *= 0 rotation_ = atan2(self.facing.x, self.facing.y); boost = boost and direction.length() > 0.1 boosting = boost and (boosting or stamina >= 1.0) and stamina > 0 @@ -92,12 +102,12 @@ func update(dt: float, boost: bool): var speed = PLAYER_SPEED * (BOOST_FACTOR if boosting else 1.) self.velocity_ += direction * dt * speed self.position_ += self.velocity_ * dt - self.velocity_ = self.velocity_ * exp( - dt * PLAYER_FRICTION) + self.velocity_ = self.velocity_ * exp(-dt * PLAYER_FRICTION) collide(dt) func collide(dt: float): - for xo in range( - 1, 2): - for yo in range( - 1, 2): + for xo in range(-1, 2): + for yo in range(-1, 2): var tile = Vector2i(xo, yo) + Vector2i(self.position_) if !game.get_tile_collision(tile): continue tile = Vector2(tile) diff --git a/client/settings.gd b/client/settings.gd index 9152c0e4..9318322b 100644 --- a/client/settings.gd +++ b/client/settings.gd @@ -27,6 +27,7 @@ static func get_root(): ToggleSetting.new("setup_completed", false), ToggleSetting.new("tutorial_started", false), ToggleSetting.new("latch_boost", true), + ToggleSetting.new("accessible_movement", false), ]), SettingsCategory.new("graphics", [ PresetRow.new("preset", { diff --git a/locale/en.ini b/locale/en.ini index 7a1d9999..a0bdc635 100644 --- a/locale/en.ini +++ b/locale/en.ini @@ -70,6 +70,7 @@ c.settings.gameplay.latch_boost=Always extend boost to maximum duration c.settings.gameplay.setup_completed=Initial setup complete. (Uncheck and restart to reenter) c.settings.gameplay.tutorial_started=Tutorial started c.settings.gameplay.usernames=Show username tags +c.settings.gameplay.accessible_movement=Accessible movement controls c.settings.gameplay=Gameplay c.settings.graphics.aa.disabled=Disabled c.settings.graphics.aa.fx=FXAA |