Blobby/src/Actors/Player.gd

41 lines
1.1 KiB
GDScript

extends KinematicBody2D
class_name Player
const PhysicsConst = preload("res://src/Utilities/Physic/PhysicsConst.gd")
const FLOOR_NORMAL := Vector2.UP
var stomp_feedback := 1200
var inair_velocity := 21
var wallslide_threshold := 1000
var base_floor_friction := 0.5
var floor_friction := base_floor_friction
var max_velocity := {
"walk": 120, "run": 160, "fall": 420, "walljump": 200, "idle": 12000, "duck": 160
}
var velocity_jump_boost_ratio := 10
# This is added to the acceleration force initially
var init_acceleration_force := {
"": 0, "idle_walk": 4181, "idle_run": 5765, "walk_run": 1000
}
# Oriented around deltas of 0.0166666...s
# newtonmeters is the unit
var acceleration_force := {
"walk": Vector2(1800, 1233),
"fall": Vector2(0, 0),
"jump": Vector2(0, 0),
"idle": Vector2(1800, 1233),
"duck": Vector2(500, 1400),
"run": Vector2(2500, 1290),
"walljump": Vector2(600, 1050),
"air_strafe": Vector2(333, 2000)
}
# Gravity as m/s^2
var _gravity: float = PhysicsConst.gravity
# Mass of Blobby
# Kilograms
var mass := 6.5
var velocity := Vector2.ZERO
var air_strafe_charges := 1