add player mph in Gamescene.gd
This commit is contained in:
parent
6fec533222
commit
35a288d34f
|
@ -177,7 +177,7 @@ const UNIT_SPRITES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const UNIT_TYPE_MOVE_SPEEDS = {
|
const UNIT_TYPE_MOVE_SPEEDS = {
|
||||||
UnitType.PLAYER: 5,
|
UnitType.PLAYER: 8,
|
||||||
UnitType.NPC: 3,
|
UnitType.NPC: 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,8 +187,8 @@ const UNIT_TYPE_JUMP_SPEEDS = {
|
||||||
|
|
||||||
const SCALE_FACTOR = 2.4
|
const SCALE_FACTOR = 2.4
|
||||||
const GRID_SIZE = 20 # pixels
|
const GRID_SIZE = 20 # pixels
|
||||||
const GRAVITY = 10
|
const GRAVITY = 16.1 # gravity = 32.17 ft/s^2, grid unit is 2ft
|
||||||
const MAX_FALL_SPEED = -9
|
const MAX_FALL_SPEED = -37
|
||||||
const ACCELERATION = 35
|
const ACCELERATION = 35
|
||||||
const QUANTUM_DIST = 0.001
|
const QUANTUM_DIST = 0.001
|
||||||
const SPAWN_DISTANCE = 10
|
const SPAWN_DISTANCE = 10
|
||||||
|
|
|
@ -43,6 +43,7 @@ const I_T_JUST_RELEASED : int = 2
|
||||||
var stage_env
|
var stage_env
|
||||||
|
|
||||||
var time_elapsed : float = 0
|
var time_elapsed : float = 0
|
||||||
|
var player_speed_mph : float = 0
|
||||||
|
|
||||||
var rng = RandomNumberGenerator.new()
|
var rng = RandomNumberGenerator.new()
|
||||||
|
|
||||||
|
@ -78,6 +79,8 @@ func _process(delta):
|
||||||
stage_env.interact(unit, delta)
|
stage_env.interact(unit, delta)
|
||||||
unit.react(delta)
|
unit.react(delta)
|
||||||
time_elapsed += 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():
|
func read_paused():
|
||||||
if Input.is_action_just_pressed(Constants.INPUT_MAP[Constants.PlayerInput.GBA_START]):
|
if Input.is_action_just_pressed(Constants.INPUT_MAP[Constants.PlayerInput.GBA_START]):
|
||||||
|
|
|
@ -2,9 +2,9 @@ extends Player
|
||||||
|
|
||||||
class_name DownhillAutoscrollerPlayer
|
class_name DownhillAutoscrollerPlayer
|
||||||
|
|
||||||
export var min_speed : float = 2
|
export var min_speed : float = 3
|
||||||
export var max_speed : float = 10
|
export var max_speed : float = 16
|
||||||
export var player_initiated_acceleration : float = 6
|
export var player_initiated_acceleration : float = 8
|
||||||
|
|
||||||
var last_contacted_map_elem_type : int = Constants.MapElemType.SQUARE
|
var last_contacted_map_elem_type : int = Constants.MapElemType.SQUARE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue