Testing out slight name change.

This commit is contained in:
SnekInAScarf 2026-11-01 10:25:40 -08:00
parent 571196f292
commit db04dfc045

View file

@ -37,13 +37,15 @@ const HOP_NO_CEILING_HEIGHT = 16.0 # Floor hop with nothing in reach, so you can
const HOP_OVERSHOOT = 2.0 # Aim slightly past the surface so we arrive with some speed and stick.
const ROTATE_TO_SURFACE_SPEED = 25.0
const MIN_LAND_SPEED = 60.0 # Slower landings don't splat.
const MIN_LAND_SPEED_FOR_SPLAT = 60.0
const LAND_PITCH_MIN = 0.87
const LAND_PITCH_MAX = 1.15
# ---- State ----
###############
## Variables ##
###############
var isStickingToWall := false
var wallNormalX := 0.0 # -1 if the wall faces left, 1 if it faces right.
var wallNormalX := 0.0
var isStickingToCeiling := false
var timeSpentUnstickingWall := 0.0
@ -71,9 +73,9 @@ var wrapArcStartAngle := 0.0 # Angle around the corner where the arc begins.
var wrapSpeed := 0.0
var wrapDistanceTravelled := 0.0
# ---- Nodes ----
###########
## Nodes ##
###########
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var collisionShape: CollisionShape2D = $CollisionShape2D
# Edge-finding raycasts, one each side, under a pivot we turn to face the surface we're on.
@ -110,7 +112,7 @@ func _physics_process(delta: float) -> void:
_update_wrap(delta)
return
var wasInAir := _get_surface_normal() == Vector2.ZERO
var wasInAir := (_get_surface_normal() == Vector2.ZERO)
if not wasInAir:
isHoppingAcross = false
@ -128,7 +130,7 @@ func _physics_process(delta: float) -> void:
_update_horizontal_movement(delta, xInput, yInput)
_hold_at_edge(delta)
var wasOnWall := isStickingToWall and not is_on_floor()
var wasOnWall := (isStickingToWall and not is_on_floor())
var velocityBeforeMove := velocity
move_and_slide()
@ -153,7 +155,7 @@ func _physics_process(delta: float) -> void:
var landedOnSomething := wasInAir and normal != Vector2.ZERO
if landedOnSomething:
var impactSpeed := velocityBeforeMove.dot(-normal)
if impactSpeed >= MIN_LAND_SPEED:
if impactSpeed >= MIN_LAND_SPEED_FOR_SPLAT:
_splat(normal)
_update_sprite_rotation(delta)
@ -167,13 +169,10 @@ func _update_facing(xInput: float, yInput: float) -> void:
if isStickingToCeiling:
sprite.flip_h = xInput > 0 # Upside down, so flipped the other way.
elif isStickingToWall:
if wallNormalX < 0:
sprite.flip_h = yInput < 0
else:
sprite.flip_h = yInput > 0
if wallNormalX < 0: sprite.flip_h = yInput < 0
else: sprite.flip_h = yInput > 0
else:
sprite.flip_h = xInput < 0
func _update_animation(xInput:float, yInput:float):
if xInput and (isStickingToCeiling or is_on_floor()):