Started working on a floaty field

This commit is contained in:
2026-01-27 19:15:00 +11:00
parent 8cf357ca68
commit ab0f5efa30
12 changed files with 146 additions and 24 deletions

View File

@@ -19,11 +19,14 @@ size = Vector2(32, 16)
[node name="Bouncy" type="Area2D"]
script = ExtResource("1_uccqy")
metadata/_edit_group_ = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_npa0g")
metadata/_edit_lock_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_qqmjc")
metadata/_edit_lock_ = true
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

34
platforms/Floaty.tscn Normal file
View File

@@ -0,0 +1,34 @@
[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"]

View File

@@ -1,6 +1,6 @@
extends Area2D
func _on_body_entered(body) -> void:
print("collision")
#print("collision")
if body is BoxBoy:
body.apply_bounce()

Binary file not shown.

10
platforms/floaty.gd Normal file
View File

@@ -0,0 +1,10 @@
extends Area2D
func _on_body_entered(body) -> void:
#print("collision")
if body is BoxBoy:
body.enable_float()
func _on_body_exited(body) -> void:
if body is BoxBoy:
body.disable_float()

1
platforms/floaty.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://6xvc47rc3xnp

BIN
platforms/floaty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://uo0dn2kbqhh8"
path="res://.godot/imported/floaty.png-42918432e8e7ab00ea08963791112ec0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://platforms/floaty.png"
dest_files=["res://.godot/imported/floaty.png-42918432e8e7ab00ea08963791112ec0.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
platforms/floaty.xcf Normal file

Binary file not shown.