From d656ee8c5e4db76139175a618bb3b8fcafa683f2 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 20 Feb 2026 20:10:42 +1100 Subject: [PATCH] Removed floaty platform/area thing It was no good. --- boxboy/boxboy.gd | 35 ------------------------------- platforms/Floaty.tscn | 34 ------------------------------ platforms/floaty.gd | 10 --------- platforms/floaty.gd.uid | 1 - platforms/floaty.png | Bin 1195 -> 0 bytes platforms/floaty.png.import | 40 ------------------------------------ scene.tscn | 6 +----- 7 files changed, 1 insertion(+), 125 deletions(-) delete mode 100644 platforms/Floaty.tscn delete mode 100644 platforms/floaty.gd delete mode 100644 platforms/floaty.gd.uid delete mode 100644 platforms/floaty.png delete mode 100644 platforms/floaty.png.import diff --git a/boxboy/boxboy.gd b/boxboy/boxboy.gd index b3ccfd1..99186b9 100644 --- a/boxboy/boxboy.gd +++ b/boxboy/boxboy.gd @@ -12,45 +12,20 @@ const GRAVITY_FALLING: int = 30 const BOUNCE_FORCE: int = -820 #about 10 tiles var just_bounced: bool = false #allow max bounce height (i.e. ignore jump input) -#floaty field -const FLOATY_RISING: int = -10 -const FLOATY_FALLING: int = -30 -const FLOATY_HEIGHT_CLEAR: float = 1_000_000_000 -var floaty_height: float = FLOATY_HEIGHT_CLEAR - #limits const MAX_MOVE_SPEED: int = 300 const MAX_FALL_SPEED: int = 500 -const MAX_FLOATY_SPEED: int = -300 #boilerplate func _ready(): - clear_floaty_height() _sprite.play("idle", 1) #movement func _physics_process(_delta) -> void: - #print(position.y, " ", floaty_height) - #jump input if is_on_floor() and Input.is_action_just_pressed("input_jump"): velocity.y -= JUMP_FORCE - #vertical movement - elif is_floaty() and position.y >= floaty_height: #below the floaty surface - if is_rising(): - velocity.y += FLOATY_RISING - else: - velocity.y += FLOATY_FALLING - - elif is_floaty() and position.y < floaty_height: ##above the floaty surface, but still floaty - if is_rising(): - velocity.y += GRAVITY_FALLING #rise slower? - else: - var diff = floaty_height - position.y - position.y += log(diff) - velocity.y = 0 - #normally, fall faster than you rise elif is_rising() and (Input.is_action_pressed("input_jump") or just_bounced): velocity.y += GRAVITY_RISING @@ -70,8 +45,6 @@ func _physics_process(_delta) -> void: velocity.x = log(abs(velocity.x)) * sign(velocity.x) #terminal velocity (in all directions) - if position.y > floaty_height and velocity.y < MAX_FLOATY_SPEED: - velocity.y = MAX_FLOATY_SPEED if is_falling() and velocity.y > MAX_FALL_SPEED: velocity.y = MAX_FALL_SPEED if abs(velocity.x) > MAX_MOVE_SPEED: @@ -96,11 +69,3 @@ func is_falling() -> bool: return velocity.y >= 0 func apply_bounce() -> void: velocity.y = BOUNCE_FORCE just_bounced = true - -func set_floaty_height(height: float) -> void: - floaty_height = height - -func clear_floaty_height() -> void: - floaty_height = FLOATY_HEIGHT_CLEAR - -func is_floaty() -> bool: return floaty_height != FLOATY_HEIGHT_CLEAR diff --git a/platforms/Floaty.tscn b/platforms/Floaty.tscn deleted file mode 100644 index 4d95576..0000000 --- a/platforms/Floaty.tscn +++ /dev/null @@ -1,34 +0,0 @@ -[gd_scene load_steps=5 format=3 uid="uid://8gd74f7ltuwk"] - -[ext_resource type="Script" uid="uid://6xvc47rc3xnp" path="res://platforms/floaty.gd" id="1_nilcs"] -[ext_resource type="Texture2D" uid="uid://uo0dn2kbqhh8" path="res://platforms/floaty.png" id="1_tt70t"] - -[sub_resource type="SpriteFrames" id="SpriteFrames_nilcs"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": ExtResource("1_tt70t") -}], -"loop": true, -"name": &"default", -"speed": 5.0 -}] - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_cftfe"] -size = Vector2(64, 64) - -[node name="Floaty" type="Area2D"] -script = ExtResource("1_nilcs") -metadata/_edit_group_ = true - -[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] -z_index = -100 -sprite_frames = SubResource("SpriteFrames_nilcs") -metadata/_edit_lock_ = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_cftfe") -metadata/_edit_lock_ = true - -[connection signal="body_entered" from="." to="." method="_on_body_entered"] -[connection signal="body_exited" from="." to="." method="_on_body_exited"] diff --git a/platforms/floaty.gd b/platforms/floaty.gd deleted file mode 100644 index c23a569..0000000 --- a/platforms/floaty.gd +++ /dev/null @@ -1,10 +0,0 @@ -extends Area2D - -func _on_body_entered(body) -> void: - #print("collision") - if body is BoxBoy: - body.set_floaty_height(position.y + $CollisionShape2D.shape.get_rect().position.y) - -func _on_body_exited(body) -> void: - if body is BoxBoy: - body.clear_floaty_height() diff --git a/platforms/floaty.gd.uid b/platforms/floaty.gd.uid deleted file mode 100644 index d68f2fa..0000000 --- a/platforms/floaty.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://6xvc47rc3xnp diff --git a/platforms/floaty.png b/platforms/floaty.png deleted file mode 100644 index fe08a12aa866ee36f20e1267511e347e0ef82580..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1195 zcmV;c1XTNpP)EX>4Tx04R}tk-ba9P!z>aQ>7vmK|6>#WT;Md(ISpog(6f4wL+^7CNKShCJjl7 zi=*ILaPVWX>fqw6tAnc`2!4S02Z)oRiTxwGn1Ytju4B*4pustl}wE|P8?M=o$`gO z$13M7&RV6$TKD8H4CnQgWvu?YAB-u8!_5-QY@tDJmKRXcKs5$6mpfp z$gzMbG{~+W{11N5)+$U*dP(5~(EZ{#A7emh7iiWU=lj@knkPW;8MxBh{%Ql5`6RvG z)}lv1|2A-O-PV*n;Bp5TdNO2FcBLRKp-=$c&*+b?)ds_4R0jTJ5yl6UF(f|Me24YJ`L;yhm2>_uo&|-H0000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2kHSE2Ok@Q1G=36000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}0007lNkltH)=&GNgbklF(qPs3zT%>ecy3iIuC`hr87#ovrx)Ewyn~8bM zIm`PvcldFJIWsWo`Fk3KI5Z&-0T2KI5C8#aXQU!e!VBQ&Ngl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