From 86b9250decc8585ee3d6960851289ac8155d183b Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 23 Jan 2018 19:22:57 -0500 Subject: [PATCH] Speed up heroes over time, resetting with switch Hero 0 speeds up especially quickly! --- scripts/heroes/0.gd | 5 ++++- scripts/player.gd | 26 ++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/scripts/heroes/0.gd b/scripts/heroes/0.gd index eba9854..b21cca7 100644 --- a/scripts/heroes/0.gd +++ b/scripts/heroes/0.gd @@ -10,7 +10,10 @@ var wallride_forgiveness = .150 func _ready(): ._ready() - walk_speed *= 1.5 + walk_speed *= 1 + air_accel *= 1.5 + walk_speed_build *= 2 + air_speed_build *= 3 func control_player(state): .control_player(state) diff --git a/scripts/player.gd b/scripts/player.gd index 4225c75..ca9e4b6 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -7,14 +7,18 @@ var yaw = 0 var pitch = 0 # Walking speed and jumping height are defined later. -var walk_speed = 1 -var jump_speed = 3 -const air_accel = .6 -var floor_friction = 0.92 -var air_friction = 0.98 +var walk_speed = 0.8 # Actually acceleration; m/s/s +var jump_speed = 3 # m/s +var air_accel = .3 # m/s/s +var floor_friction = 1-0.08 +var air_friction = 1-0.03 var player_info # Set by lobby +var walk_speed_build = 0.006 # `walk_speed` per `switch_charge` +var air_speed_build = 0.006 # `air_accel` per `switch_chare` + var switch_charge = 0 +var switch_charge_cap = 200 # While switching is always at 100, things like speed boost might go higher! var movement_charge = 0.15 # In percent per meter (except when heroes change that) var debug_node @@ -127,7 +131,8 @@ func control_player(state): var floor_velocity = Vector3() var object = ray.get_collider() - state.apply_impulse(Vector3(), direction * walk_speed * get_mass()) + var accel = (1 + switch_charge * walk_speed_build) * walk_speed + state.apply_impulse(Vector3(), direction * accel * get_mass()) var lin_v = state.get_linear_velocity() lin_v.x *= floor_friction lin_v.z *= floor_friction @@ -137,7 +142,8 @@ func control_player(state): state.apply_impulse(Vector3(), normal * jump_speed * get_mass()) else: - state.apply_impulse(Vector3(), direction * air_accel * get_mass()) + var accel = (1 + switch_charge * air_speed_build) * air_accel + state.apply_impulse(Vector3(), direction * accel * get_mass()) var lin_v = state.get_linear_velocity() lin_v.x *= air_friction lin_v.z *= air_friction @@ -152,7 +158,11 @@ func _process(delta): var switch_node = get_node("MasterOnly/SwitchCharge") switch_node.set_text("%.f%%" % switch_charge) if switch_charge >= 100: - switch_node.set_text("100%\nQ - Switch hero") + # Let switch_charge keep building, because we use it for walk_speed and things + switch_node.set_text("100%% (%.f)\nQ - Switch hero" % switch_charge) + if switch_charge > switch_charge_cap: + # There is however a cap + switch_charge = switch_charge_cap func switch_hero_interface(): # Interface needs the mouse!