Revert "blah"

This reverts commit 454624856d1f686e4ce5e3df4e6a5e2b47cfc83d.
This commit is contained in:
SnekInAScarf 2026-10-29 22:06:11 -07:00
parent f70cc0b97a
commit 64188a72d3
3 changed files with 17 additions and 7 deletions

1
.vscode/settings.json vendored Executable file
View file

@ -0,0 +1 @@
{}

View file

@ -1,8 +1,9 @@
extends CharacterBody2D extends CharacterBody2D
const MOVE_SPEED = 150.0 const GROUND_SPEED = 150.0
const AIR_SPEED = 75.0
const CLIMB_SPEED = -150.0 const CLIMB_SPEED = -150.0
const JUMP_VELOCITY = -250.0
const ROTATE_TO_WALL_SPEED = 25 # How quickly to rotate the sprite when clinging to a wall. const ROTATE_TO_WALL_SPEED = 25 # How quickly to rotate the sprite when clinging to a wall.
const CEILING_STICK_SPEED = -20.0 # Small upward push that keeps the slime pressed against the ceiling. const CEILING_STICK_SPEED = -20.0 # Small upward push that keeps the slime pressed against the ceiling.
@ -46,31 +47,36 @@ func _physics_process(delta: float) -> void:
# If on ceiling, pressing down long enough unsticks from ceiling. # If on ceiling, pressing down long enough unsticks from ceiling.
if verticalInput < 0: timeSpentUnstickingCeiling += delta if verticalInput < 0: timeSpentUnstickingCeiling += delta
else: timeSpentUnstickingCeiling = 0.0 else: timeSpentUnstickingCeiling = 0.0
if timeSpentUnstickingCeiling >= MAX_SECS_TO_UNSTICK: if timeSpentUnstickingCeiling >= MAX_SECS_TO_UNSTICK:
isStickingToCeiling = false isStickingToCeiling = false
velocity.y = get_gravity().y * delta velocity.y = get_gravity().y * delta
else: velocity.y = CEILING_STICK_SPEED else: velocity.y = CEILING_STICK_SPEED
# Move up and down along a wall when sticking to it. # Move up and down along a wall when sticking to it.
elif isStickingToWall: elif isStickingToWall:
velocity.y = CLIMB_SPEED * verticalInput velocity.y = CLIMB_SPEED * verticalInput
elif not is_on_floor(): elif not is_on_floor():
velocity.y += get_gravity().y * delta velocity.y += get_gravity().y * delta
# Horizontal Input Controls
# If sticking to a wall, pressing away from it long enough gets us unstuck. # If sticking to a wall, pressing away from it long enough gets us unstuck.
if isStickingToWall and not is_on_floor(): if isStickingToWall and not is_on_floor():
var pressingAwayFromWall := horizontalInput * wallNormalX > 0 var pressingAwayFromWall := horizontalInput * wallNormalX > 0
if pressingAwayFromWall: timeSpentUnstickingWall += delta if pressingAwayFromWall: timeSpentUnstickingWall += delta
else: timeSpentUnstickingWall = 0.0 else: timeSpentUnstickingWall = 0.0
if timeSpentUnstickingWall >= MAX_SECS_TO_UNSTICK: if timeSpentUnstickingWall >= MAX_SECS_TO_UNSTICK:
velocity.x = horizontalInput * MOVE_SPEED velocity.x = horizontalInput * GROUND_SPEED
else: else:
velocity.x = -wallNormalX * WALL_STICK_SPEED velocity.x = -wallNormalX * WALL_STICK_SPEED
# Otherwise move horizontally based on what we're on.
else: else:
timeSpentUnstickingWall = 0.0 timeSpentUnstickingWall = 0.0
if horizontalInput: velocity.x = horizontalInput * MOVE_SPEED if horizontalInput and (is_on_floor() or isStickingToCeiling):
else: velocity.x = move_toward(velocity.x, 0, MOVE_SPEED) velocity.x = horizontalInput * GROUND_SPEED
elif horizontalInput and not (is_on_floor() or isStickingToCeiling):
velocity.x = horizontalInput * AIR_SPEED
else:
velocity.x = move_toward(velocity.x, 0, GROUND_SPEED)
move_and_slide() move_and_slide()
@ -78,6 +84,8 @@ func _physics_process(delta: float) -> void:
isStickingToWall = is_on_wall() isStickingToWall = is_on_wall()
if isStickingToWall: if isStickingToWall:
wallNormalX = get_wall_normal().x wallNormalX = get_wall_normal().x
# Check if we are attempting to climb a lip.
isStickingToCeiling = is_on_ceiling() isStickingToCeiling = is_on_ceiling()
# In a corner touching both wall and ceiling, only stick to one # In a corner touching both wall and ceiling, only stick to one

View file

@ -70,6 +70,7 @@ pause={
[physics] [physics]
3d/physics_engine="Jolt Physics" 3d/physics_engine="Jolt Physics"
2d/default_gravity=700.0
[rendering] [rendering]