feat: change boat collision and improve overall code

This commit is contained in:
2025-03-22 20:43:05 +01:00
parent d0ad5f4fe5
commit ac556e3715
9 changed files with 108 additions and 91 deletions

View File

@@ -1,27 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://crxp1lat0mj1n"]
[gd_scene load_steps=2 format=3 uid="uid://crxp1lat0mj1n"]
[sub_resource type="Gradient" id="Gradient_7c5k4"]
offsets = PackedFloat32Array(0, 0.00371747, 0.736059, 0.754647, 1)
colors = PackedColorArray(0, 0, 0, 1, 0.94902, 0.0509804, 0.0509804, 1, 0.15042, 0.503262, 0.834652, 1, 0.117488, 0.521912, 0.866968, 1, 0.94902, 0.0509804, 0.0509804, 1)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_exqad"]
size = Vector2(128, 128)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_eesv4"]
gradient = SubResource("Gradient_7c5k4")
fill_from = Vector2(1, 0)
fill_to = Vector2(0, 1)
[sub_resource type="SegmentShape2D" id="SegmentShape2D_dliv6"]
a = Vector2(9.78128e-07, 0.256411)
b = Vector2(9.78128e-07, 33.0769)
[node name="Barrier" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(5.96046e-08, 0)
scale = Vector2(0.203125, 2.01563)
texture = SubResource("GradientTexture2D_eesv4")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-3.8147e-06, -65)
scale = Vector2(3.9, 3.9)
shape = SubResource("SegmentShape2D_dliv6")
one_way_collision_margin = 51.0
[node name="Barrier" type="CollisionShape2D"]
shape = SubResource("RectangleShape2D_exqad")

View File

@@ -3,5 +3,11 @@
[ext_resource type="Script" uid="uid://bvejqjdvu7eb1" path="res://scripts/boat.gd" id="1_brclq"]
[node name="Boat" type="Node2D"]
position = Vector2(-1, 0)
script = ExtResource("1_brclq")
[node name="Area2D" type="Area2D" parent="."]
unique_name_in_owner = true
[node name="StaticBody2D" type="StaticBody2D" parent="."]
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://dy71gkll44btc"]
[gd_scene load_steps=5 format=3 uid="uid://dy71gkll44btc"]
[ext_resource type="Script" uid="uid://ceijb6ltpgsy1" path="res://scripts/player.gd" id="1_jlots"]
[ext_resource type="Texture2D" uid="uid://s4iiumvei5wc" path="res://assets/triangle.svg" id="2_jjceo"]
@@ -6,11 +6,15 @@
[sub_resource type="CircleShape2D" id="CircleShape2D_g2els"]
radius = 6.0
[sub_resource type="CircleShape2D" id="CircleShape2D_qhqgy"]
[node name="Player" type="CharacterBody2D"]
collision_layer = 2
motion_mode = 1
script = ExtResource("1_jlots")
[node name="Sprite2D2" type="Sprite2D" parent="."]
z_index = 100
position = Vector2(5, 0)
rotation = -1.5708
scale = Vector2(0.230709, 0.642787)
@@ -18,3 +22,9 @@ texture = ExtResource("2_jjceo")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_g2els")
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_qhqgy")

View File

@@ -5,6 +5,7 @@
[node name="Tile" type="Node2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
modulate = Color(1, 1, 1, 0.337255)
position = Vector2(0, 2.28882e-05)
scale = Vector2(0.074, 0.0740913)
texture = ExtResource("1_bgcjk")