From 35a288d34f71291ace62bcde06376c3937a50b79 Mon Sep 17 00:00:00 2001 From: D L Date: Fri, 27 Jan 2023 14:30:20 -0800 Subject: [PATCH] add player mph in Gamescene.gd --- Scripts/Constants.gd | 6 +++--- Scripts/GameScene.gd | 3 +++ Scripts/Units/DownhillAutoscrollerPlayer.gd | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Scripts/Constants.gd b/Scripts/Constants.gd index 3b38dfa..d8562d9 100644 --- a/Scripts/Constants.gd +++ b/Scripts/Constants.gd @@ -177,7 +177,7 @@ const UNIT_SPRITES = { } const UNIT_TYPE_MOVE_SPEEDS = { - UnitType.PLAYER: 5, + UnitType.PLAYER: 8, UnitType.NPC: 3, } @@ -187,8 +187,8 @@ const UNIT_TYPE_JUMP_SPEEDS = { const SCALE_FACTOR = 2.4 const GRID_SIZE = 20 # pixels -const GRAVITY = 10 -const MAX_FALL_SPEED = -9 +const GRAVITY = 16.1 # gravity = 32.17 ft/s^2, grid unit is 2ft +const MAX_FALL_SPEED = -37 const ACCELERATION = 35 const QUANTUM_DIST = 0.001 const SPAWN_DISTANCE = 10 diff --git a/Scripts/GameScene.gd b/Scripts/GameScene.gd index 8779c55..ef96c26 100644 --- a/Scripts/GameScene.gd +++ b/Scripts/GameScene.gd @@ -43,6 +43,7 @@ const I_T_JUST_RELEASED : int = 2 var stage_env var time_elapsed : float = 0 +var player_speed_mph : float = 0 var rng = RandomNumberGenerator.new() @@ -78,6 +79,8 @@ func _process(delta): stage_env.interact(unit, delta) unit.react(delta) time_elapsed += delta + # 1 grid unit = 2ft, 1 grid unit / s = 1.36 mph + player_speed_mph = sqrt(pow(player.v_speed, 2) + pow(player.h_speed, 2)) * 1.36 func read_paused(): if Input.is_action_just_pressed(Constants.INPUT_MAP[Constants.PlayerInput.GBA_START]): diff --git a/Scripts/Units/DownhillAutoscrollerPlayer.gd b/Scripts/Units/DownhillAutoscrollerPlayer.gd index cbc65a9..cc5ef80 100644 --- a/Scripts/Units/DownhillAutoscrollerPlayer.gd +++ b/Scripts/Units/DownhillAutoscrollerPlayer.gd @@ -2,9 +2,9 @@ extends Player class_name DownhillAutoscrollerPlayer -export var min_speed : float = 2 -export var max_speed : float = 10 -export var player_initiated_acceleration : float = 6 +export var min_speed : float = 3 +export var max_speed : float = 16 +export var player_initiated_acceleration : float = 8 var last_contacted_map_elem_type : int = Constants.MapElemType.SQUARE