From 8fa42abc6f4e5b2f4cc9b7d7aa9a925a8c1aa28e Mon Sep 17 00:00:00 2001 From: debugman18 <5280045+debugman18@users.noreply.github.com> Date: Sun, 18 Oct 2026 16:10:14 -0500 Subject: [PATCH] Moving block added (buggy) --- horizontal_moving_block.gd | 11 +++++++++++ horizontal_moving_block.gd.uid | 1 + horizontal_moving_block.tscn | 19 +++++++++++++++++++ world.tscn | 4 ++++ 4 files changed, 35 insertions(+) create mode 100644 horizontal_moving_block.gd create mode 100644 horizontal_moving_block.gd.uid create mode 100644 horizontal_moving_block.tscn diff --git a/horizontal_moving_block.gd b/horizontal_moving_block.gd new file mode 100644 index 0000000..c5070d6 --- /dev/null +++ b/horizontal_moving_block.gd @@ -0,0 +1,11 @@ +extends RigidBody2D + +var max_distance = position + Vector2(1,0) + +func _ready() -> void: + print("START POSITION: " + str(position)) + pass + +func _process(delta: float) -> void: + print("NEW POSITION :" + str(position)) + position.x = move_toward(position.x, max_distance.x, 1) diff --git a/horizontal_moving_block.gd.uid b/horizontal_moving_block.gd.uid new file mode 100644 index 0000000..e8cb1b3 --- /dev/null +++ b/horizontal_moving_block.gd.uid @@ -0,0 +1 @@ +uid://yaqgvctkobnq diff --git a/horizontal_moving_block.tscn b/horizontal_moving_block.tscn new file mode 100644 index 0000000..5924443 --- /dev/null +++ b/horizontal_moving_block.tscn @@ -0,0 +1,19 @@ +[gd_scene format=3 uid="uid://div6quttr84u1"] + +[ext_resource type="Script" uid="uid://yaqgvctkobnq" path="res://horizontal_moving_block.gd" id="1_3uo2v"] +[ext_resource type="Texture2D" uid="uid://blbaaqyrt8dtk" path="res://art/block/block.png" id="1_m1vtb"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_f3sb7"] +size = Vector2(16, 14) + +[node name="Block" type="RigidBody2D" unique_id=1409784601] +gravity_scale = 0.0 +freeze = true +script = ExtResource("1_3uo2v") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1866755047] +shape = SubResource("RectangleShape2D_f3sb7") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1680278216] +texture_filter = 1 +texture = ExtResource("1_m1vtb") diff --git a/world.tscn b/world.tscn index 47dc1ce..ab7ade5 100644 --- a/world.tscn +++ b/world.tscn @@ -33,6 +33,7 @@ [ext_resource type="Script" uid="uid://b65drnv6461kp" path="res://hidden_spike.gd" id="29_qktwf"] [ext_resource type="PackedScene" uid="uid://big8haq2m0jxw" path="res://sign_arrow.tscn" id="30_bh8nc"] [ext_resource type="PackedScene" uid="uid://cue2gfw1bdfh7" path="res://sign_arrow_up.tscn" id="31_jjr1n"] +[ext_resource type="PackedScene" uid="uid://div6quttr84u1" path="res://horizontal_moving_block.tscn" id="34_w44yn"] [node name="World" type="Node2D" unique_id=1327991900] process_mode = 1 @@ -936,4 +937,7 @@ position = Vector2(-149, -643.96545) position = Vector2(-189, -645.93475) sign_text = "TAKE A LEAP" +[node name="Block20" parent="." unique_id=1489084043 instance=ExtResource("34_w44yn")] +position = Vector2(-4824, 299.3356) + [connection signal="toggled" from="CanvasLayer/MusicButton" to="CanvasLayer/MusicButton" method="_on_toggled"]