Blobby/src/Actors/Actor.gd

48 lines
1.4 KiB
GDScript

extends KinematicBody2D
class_name Actor
onready var levelState := get_tree().root.get_child(1).get_node("%LevelState")
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
const PhysicsConst = preload("res://src/Utilities/Physic/PhysicsConst.gd")
const FLOOR_NORMAL := Vector2.UP
var stomp_feedback := 1400
var reset_stomp_time := 0.108
var stomp_time := 0.108
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, "jump": Vector2(120, 420), "fall": Vector2(120, 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, 1300),
"fall": Vector2(1800, 0),
"jump": Vector2(1800, 0),
"idle": Vector2(1800, 1233),
"duck": Vector2(500, 1300),
"run": Vector2(2500, 1400),
"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 max_air_strafe_charges := 0
var air_strafe_charges := 0