First level prototype, fixed inair movement
This commit is contained in:
parent
fb52fd0ecd
commit
6951028145
6
.gitignore
vendored
6
.gitignore
vendored
@ -26,5 +26,7 @@ export_presets.cfg
|
||||
data_*/
|
||||
|
||||
# VSCode specific ignores
|
||||
/.vscode
|
||||
.vscode/launch.json
|
||||
/.vscode/*
|
||||
/.vscode/launch.json
|
||||
*/.vscode/*
|
||||
*/.vscode/launch.json
|
||||
|
||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -8,7 +8,7 @@
|
||||
"name": "GDScript Godot",
|
||||
"type": "godot",
|
||||
"request": "launch",
|
||||
"project": "C:\\Users\\Jakob\\Documents\\Godot\\Wumper",
|
||||
"project": "C:\\Users\\Jakob F\\Documents\\Godot\\Wumper",
|
||||
"port": 6007,
|
||||
"address": "127.0.0.1",
|
||||
"launch_game_instance": true,
|
||||
|
||||
@ -61,7 +61,7 @@ window/stretch/aspect="keep"
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PoolStringArray( "res://addons/AsepriteWizard/plugin.cfg" )
|
||||
enabled=PoolStringArray( )
|
||||
|
||||
[global]
|
||||
|
||||
@ -146,6 +146,8 @@ boost_move={
|
||||
quality/intended_usage/framebuffer_allocation=0
|
||||
quality/intended_usage/framebuffer_allocation.mobile=0
|
||||
2d/snapping/use_gpu_pixel_snap=true
|
||||
quality/filters/use_nearest_mipmap_filter=true
|
||||
quality/filters/msaa=1
|
||||
environment/default_environment="res://default_env.tres"
|
||||
quality/2d/use_pixel_snap=true
|
||||
environment/2d/use_nvidia_rect_flicker_workaround=true
|
||||
|
||||
@ -147,8 +147,9 @@ func is_correct_airstrafe_input() -> bool:
|
||||
return (
|
||||
air_strafe_charges > 0
|
||||
&& (
|
||||
Input.is_action_just_pressed("move_right")
|
||||
||
|
||||
Input.is_action_just_pressed("move_left")
|
||||
|| Input.is_action_just_pressed("move_right")
|
||||
)
|
||||
)
|
||||
|
||||
@ -191,11 +192,11 @@ func calculate_jump_velocity(
|
||||
linear_velocity.y += _gravity * delta
|
||||
|
||||
# TODO Dis shizzle buggy
|
||||
# TODO is boosting part of jump?
|
||||
if is_equal_approx(velocity.x, 0):
|
||||
if (-4 < velocity.x and velocity.x < 4) :
|
||||
linear_velocity.x += inair_velocity * direction.x
|
||||
|
||||
if is_correct_airstrafe_input() && !walljumping:
|
||||
# var rev = 1 if !is_reversing_horizontal_movement(direction) else -1
|
||||
linear_velocity.x = PhysicsFunc.two_step_euler(
|
||||
linear_velocity.x,
|
||||
acceleration_force["air_strafe"].x * direction.x,
|
||||
@ -219,13 +220,13 @@ func calculate_fall_velocity(
|
||||
)
|
||||
else:
|
||||
linear_velocity.y = max_velocity["fall"]
|
||||
# TODO Gets velocity away from wall when moving against it
|
||||
if (-4 < velocity.x and velocity.x < 4) :
|
||||
# TODO This is poop
|
||||
linear_velocity.x += inair_velocity * direction.x
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
jump_buffer_filled = true
|
||||
if is_correct_airstrafe_input():
|
||||
# var rev = 1 if !is_reversing_horizontal_movement(direction) else -1
|
||||
linear_velocity.x = PhysicsFunc.two_step_euler(
|
||||
linear_velocity.x,
|
||||
acceleration_force["air_strafe"].x * direction.x,
|
||||
@ -250,9 +251,10 @@ func calculate_wallslide_velocity(
|
||||
# TODO this is done 3 times for different states
|
||||
# TODO make air strafe a portionable boost instead of a one time acceleration (or not?! whaaat?)
|
||||
elif is_correct_airstrafe_input():
|
||||
# var rev = 1 if !is_reversing_horizontal_movement(direction) else -1
|
||||
linear_velocity.x = PhysicsFunc.two_step_euler(
|
||||
linear_velocity.x,
|
||||
acceleration_force["air_strafe"].x * direction.x,
|
||||
acceleration_force["air_strafe"].x * velocity.x,
|
||||
mass,
|
||||
delta
|
||||
)
|
||||
|
||||
@ -113,6 +113,8 @@ func _get_transition(_delta):
|
||||
self.state
|
||||
+ " x vel:"
|
||||
+ String(round(parent.velocity.x))
|
||||
+ " y vel/10:"
|
||||
+ String(round(parent.velocity.y/10))
|
||||
)
|
||||
var new_state
|
||||
if !parent.is_on_floor():
|
||||
|
||||
@ -6,7 +6,7 @@ const FLOOR_NORMAL := Vector2.UP
|
||||
|
||||
var stomp_feedback := 1000.0
|
||||
var inair_velocity := 21
|
||||
var wallslide_threshold := 300
|
||||
var wallslide_threshold := 1000
|
||||
# TODO Map to floor types and move to physics constants
|
||||
var normal_floor_friction := 0.5
|
||||
var max_velocity := {
|
||||
@ -23,7 +23,7 @@ var acceleration_force := {
|
||||
"walk": Vector2(2000, 74000),
|
||||
"idle": Vector2(2000, 74000),
|
||||
"run": Vector2(2800, 74000),
|
||||
"walljump": Vector2(36000, 74000),
|
||||
"walljump": Vector2(36000, 63000),
|
||||
"air_strafe": Vector2(20000, 100)
|
||||
}
|
||||
# Gravity as m/s^2
|
||||
|
||||
56
src/Levels/1Level.tscn
Normal file
56
src/Levels/1Level.tscn
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user