Blobby/src/Actors/Player.gd
Jakob Feldmann 6605221398 Fixed velocity problem for landing on moving floors
The problem was that blobby got the velocity
of the velocity_jump_boost added to him whilst
jumping on a moving platform without moving
2022-05-31 23:09:43 +02:00

38 lines
1022 B
GDScript

extends KinematicBody2D
class_name Player
const PhysicsConst = preload("res://src/Utilities/Physic/PhysicsConst.gd")
const FLOOR_NORMAL := Vector2.UP
var stomp_feedback := 1000.0
var inair_velocity := 21
var wallslide_threshold := 300
# TODO Map to floor types and move to physics constants
var normal_floor_friction := 0.5
var max_velocity := {
"walk": 120, "run": 160, "fall": 400, "walljump": 150, "idle": 120
}
var velocity_jump_boost_ratio := 12
# This is added to the acceleration force initially
var init_acceleration_force := {
"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(2000, 68000),
"idle": Vector2(2000, 68000),
"run": Vector2(2000, 68000),
"walljump": Vector2(30000, 58000),
"air_strafe": Vector2(20000, 0)
}
# 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