Changed name capitalization

This commit is contained in:
2026-02-20 20:22:54 +11:00
parent d656ee8c5e
commit 609d448a12
23 changed files with 32 additions and 32 deletions

71
BoxBoy/BoxBoy.gd Normal file
View File

@@ -0,0 +1,71 @@
class_name BoxBoy extends CharacterBody2D
@onready var _sprite = $AnimatedSprite2D
const MOVE_FORCE: int = 300
const JUMP_FORCE: int = 500 #about 4 tiles
const GRAVITY_RISING: int = 15
const GRAVITY_FALLING: int = 30
#bouncy platform
const BOUNCE_FORCE: int = -820 #about 10 tiles
var just_bounced: bool = false #allow max bounce height (i.e. ignore jump input)
#limits
const MAX_MOVE_SPEED: int = 300
const MAX_FALL_SPEED: int = 500
#boilerplate
func _ready():
_sprite.play("idle", 1)
#movement
func _physics_process(_delta) -> void:
#jump input
if is_on_floor() and Input.is_action_just_pressed("input_jump"):
velocity.y -= JUMP_FORCE
#normally, fall faster than you rise
elif is_rising() and (Input.is_action_pressed("input_jump") or just_bounced):
velocity.y += GRAVITY_RISING
else:
velocity.y += GRAVITY_FALLING
just_bounced = false
#sideways movement
var move_dir = Input.get_axis("input_left", "input_right")
if move_dir:
_sprite.flip_h = move_dir < 0 #fancy HD 4K graphics
velocity.x += MOVE_FORCE * move_dir
#no input, slow down
elif velocity.x != 0:
velocity.x = log(abs(velocity.x)) * sign(velocity.x)
#terminal velocity (in all directions)
if is_falling() and velocity.y > MAX_FALL_SPEED:
velocity.y = MAX_FALL_SPEED
if abs(velocity.x) > MAX_MOVE_SPEED:
velocity.x = MAX_MOVE_SPEED * sign(velocity.x)
#do the thing
move_and_slide()
#animation stuff
func _on_animation_finished() -> void:
if randf() < 0.2:
_sprite.play("idle_glance", 2)
else:
_sprite.play("idle", 2)
#utils
#func is_airborne() -> bool: return !is_on_floor()
func is_rising() -> bool: return velocity.y < 0
func is_falling() -> bool: return velocity.y >= 0
#external actions
func apply_bounce() -> void:
velocity.y = BOUNCE_FORCE
just_bounced = true

1
BoxBoy/BoxBoy.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://c2x51mppxugpn

BIN
BoxBoy/BoxBoy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

40
BoxBoy/BoxBoy.png.import Normal file
View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bpjhq0b2dae1d"
path="res://.godot/imported/BoxBoy.png-8fb8d8a73948ea962ed297f129f0e222.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://BoxBoy/BoxBoy.png"
dest_files=["res://.godot/imported/BoxBoy.png-8fb8d8a73948ea962ed297f129f0e222.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
BoxBoy/boxboy.xcf Normal file

Binary file not shown.