diff --git a/game/levels/test_level.tscn b/game/levels/test_level.tscn index 74ddd49..47382b7 100644 --- a/game/levels/test_level.tscn +++ b/game/levels/test_level.tscn @@ -9,7 +9,7 @@ [ext_resource type="Shader" uid="uid://dbsrm43wcolg4" path="res://game/shaders/connection_cable.gdshader" id="4_lxcjr"] [ext_resource type="PackedScene" uid="uid://g0n5npbt3hb2" path="res://game/doors/circle_door.tscn" id="4_yrqjd"] [ext_resource type="PackedScene" uid="uid://cojxqx5al7kyv" path="res://game/doors/locked_door.tscn" id="5_1skah"] -[ext_resource type="PackedScene" uid="uid://bwmd8w677p7k3" path="res://game/platform/color_switching_platform.tscn" id="5_a50fq"] +[ext_resource type="PackedScene" uid="uid://bwmd8w677p7k3" path="res://game/platform/trigger_color_platform.tscn" id="5_a50fq"] [ext_resource type="PackedScene" uid="uid://dwvv5dj8lqif2" path="res://game/doors/triangle_door.tscn" id="6_75eok"] [ext_resource type="PackedScene" uid="uid://b7imlh4sl036i" path="res://game/doors/square_door.tscn" id="7_1skah"] [ext_resource type="PackedScene" uid="uid://cudbspmpx6sik" path="res://game/pickups/book_pickup.tscn" id="7_fq0h3"] diff --git a/game/materials/platform_color.tres b/game/materials/platform_color.tres index 26785e0..e2ab713 100644 --- a/game/materials/platform_color.tres +++ b/game/materials/platform_color.tres @@ -6,7 +6,7 @@ shader = ExtResource("1_p23e2") shader_parameter/black_color = Color(0, 0, 0, 1) shader_parameter/white_color = Color(1, 1, 1, 1) -shader_parameter/switch_colors = true +shader_parameter/switch_colors = false shader_parameter/threshold = 0.5 shader_parameter/speed = 1.0 shader_parameter/intensity = 1.0 diff --git a/game/platform/abstract_platform.gd b/game/platform/abstract_platform.gd index f8e63a5..8c2b6be 100644 --- a/game/platform/abstract_platform.gd +++ b/game/platform/abstract_platform.gd @@ -36,7 +36,6 @@ const MAX_WIDTH = TILE_SIZE * 32 @onready var collision: CollisionShape2D = $CollisionShape2D -@onready var standing_check_collision: CollisionShape2D = $Area2D/CollisionShape2D @onready var sub_viewport: SubViewport = $SubViewport @onready var platform_sprite: Sprite2D = $Sprite2D @onready var platform_rect: ColorRect = $SubViewport/PlatformRect @@ -52,7 +51,6 @@ func _ready() -> void: func rebuild_platform() -> void: collision.shape.size.x = platform_width - standing_check_collision.shape.size.x = platform_width - 4 var platfor_size := Vector2(platform_width, TILE_SIZE) diff --git a/game/platform/abstract_platform.tscn b/game/platform/abstract_platform.tscn index 12cd9c5..3924a81 100644 --- a/game/platform/abstract_platform.tscn +++ b/game/platform/abstract_platform.tscn @@ -4,7 +4,7 @@ [ext_resource type="Material" uid="uid://2hd2pw5cgn1r" path="res://game/materials/platform_gray.tres" id="2_2ivtb"] [ext_resource type="Texture2D" uid="uid://cpcuokqv8u2xa" path="res://images/level/platform.png" id="2_31xwx"] [ext_resource type="Shader" uid="uid://d4hm3vjx1rhsf" path="res://game/shaders/platform.gdshader" id="2_jsq8n"] -[ext_resource type="Texture2D" uid="uid://bi2h4g71bro7v" path="res://images/level/platform-icons.png" id="5_hgabr"] +[ext_resource type="Texture2D" uid="uid://bi2h4g71bro7v" path="res://images/level/platform_icons.png" id="5_hgabr"] [sub_resource type="ViewportTexture" id="ViewportTexture_2ivtb"] viewport_path = NodePath("SubViewport") @@ -225,22 +225,6 @@ region = Rect2(16, 48, 8, 8) atlas = ExtResource("5_hgabr") region = Rect2(8, 48, 8, 8) -[sub_resource type="AtlasTexture" id="AtlasTexture_4g8bw"] -atlas = ExtResource("5_hgabr") -region = Rect2(0, 64, 8, 8) - -[sub_resource type="AtlasTexture" id="AtlasTexture_mhe6c"] -atlas = ExtResource("5_hgabr") -region = Rect2(8, 64, 8, 8) - -[sub_resource type="AtlasTexture" id="AtlasTexture_d8o7t"] -atlas = ExtResource("5_hgabr") -region = Rect2(16, 64, 8, 8) - -[sub_resource type="AtlasTexture" id="AtlasTexture_txrl7"] -atlas = ExtResource("5_hgabr") -region = Rect2(24, 64, 8, 8) - [sub_resource type="SpriteFrames" id="SpriteFrames_j4n83"] animations = [{ "frames": [{ @@ -470,32 +454,12 @@ animations = [{ "loop": 1, "name": &"self_moving", "speed": 10.0 -}, { -"frames": [{ -"duration": 15.0, -"texture": SubResource("AtlasTexture_4g8bw") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_mhe6c") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_d8o7t") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_txrl7") -}], -"loop": 1, -"name": &"timer", -"speed": 10.0 }] [sub_resource type="RectangleShape2D" id="RectangleShape2D_jsq8n"] resource_local_to_scene = true size = Vector2(16, 7) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_bhunq"] -size = Vector2(12, 1) - [node name="AbstractPlatform" type="AnimatableBody2D" unique_id=137546339] collision_mask = 0 script = ExtResource("1_426vp") @@ -531,14 +495,8 @@ size_flags_vertical = 4 [node name="IconSprite" type="AnimatedSprite2D" parent="SubViewport" unique_id=1917841765] position = Vector2(8, 4) sprite_frames = SubResource("SpriteFrames_j4n83") +animation = &"self_moving" [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=175449124] position = Vector2(0, -0.5) shape = SubResource("RectangleShape2D_jsq8n") - -[node name="Area2D" type="Area2D" parent="." unique_id=1655744842] - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=1261028767] -position = Vector2(0, -4.5) -shape = SubResource("RectangleShape2D_bhunq") -debug_color = Color(0.9020316, 0.24375501, 0.4918024, 0.41960785) diff --git a/game/platform/touch_color_platform.gd b/game/platform/touch_color_platform.gd new file mode 100644 index 0000000..a8ba622 --- /dev/null +++ b/game/platform/touch_color_platform.gd @@ -0,0 +1,10 @@ +@tool +class_name TouchColorPlatform +extends AbstractColorPlatform + + +@onready var touch_check_collision: CollisionShape2D = $Area2D/CollisionShape2D + +func rebuild_platform() -> void: + super.rebuild_platform() + touch_check_collision.shape.size.x = platform_width - 4 diff --git a/game/platform/touch_color_platform.gd.uid b/game/platform/touch_color_platform.gd.uid new file mode 100644 index 0000000..b835a0f --- /dev/null +++ b/game/platform/touch_color_platform.gd.uid @@ -0,0 +1 @@ +uid://d2xfxje428psp diff --git a/game/platform/touch_color_platform.tscn b/game/platform/touch_color_platform.tscn new file mode 100644 index 0000000..e1a36d9 --- /dev/null +++ b/game/platform/touch_color_platform.tscn @@ -0,0 +1,43 @@ +[gd_scene format=3 uid="uid://cpntbx0bpni2t"] + +[ext_resource type="PackedScene" uid="uid://wpkj48bqyuy2" path="res://game/platform/abstract_color_platform.tscn" id="1_xxggt"] +[ext_resource type="Shader" uid="uid://d4hm3vjx1rhsf" path="res://game/shaders/platform.gdshader" id="2_4n4xw"] +[ext_resource type="Script" uid="uid://d2xfxje428psp" path="res://game/platform/touch_color_platform.gd" id="2_wa58h"] +[ext_resource type="Texture2D" uid="uid://cpcuokqv8u2xa" path="res://images/level/platform.png" id="3_wa58h"] + +[sub_resource type="ViewportTexture" id="ViewportTexture_4n4xw"] +viewport_path = NodePath("SubViewport") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_wa58h"] +resource_local_to_scene = true +shader = ExtResource("2_4n4xw") +shader_parameter/tile_size = 8.0 +shader_parameter/platform_width = 24.0 +shader_parameter/atlas = ExtResource("3_wa58h") +shader_parameter/seed = 0.12241629 + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_vol56"] +resource_local_to_scene = true +size = Vector2(16, 7) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_bhunq"] +size = Vector2(12, 1) + +[node name="TouchColorPlatform" unique_id=137546339 instance=ExtResource("1_xxggt")] +script = ExtResource("2_wa58h") + +[node name="Sprite2D" parent="." index="0" unique_id=264863796] +texture = SubResource("ViewportTexture_4n4xw") + +[node name="PlatformRect" parent="SubViewport" parent_id_path=PackedInt32Array(226200089) index="0" unique_id=794315918] +material = SubResource("ShaderMaterial_wa58h") + +[node name="CollisionShape2D" parent="." index="2" unique_id=175449124] +shape = SubResource("RectangleShape2D_vol56") + +[node name="Area2D" type="Area2D" parent="." index="4" unique_id=1655744842] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" index="0" unique_id=1261028767] +position = Vector2(0, -4.5) +shape = SubResource("RectangleShape2D_bhunq") +debug_color = Color(0.9020316, 0.24375501, 0.4918024, 0.41960785) diff --git a/game/platform/color_switching_platform.gd b/game/platform/trigger_color_platform.gd similarity index 86% rename from game/platform/color_switching_platform.gd rename to game/platform/trigger_color_platform.gd index 7a654e1..1a743e6 100644 --- a/game/platform/color_switching_platform.gd +++ b/game/platform/trigger_color_platform.gd @@ -1,5 +1,5 @@ @tool -class_name ColorSwitchingPlatform +class_name TriggerColorPlatform extends AbstractColorPlatform diff --git a/game/platform/color_switching_platform.gd.uid b/game/platform/trigger_color_platform.gd.uid similarity index 100% rename from game/platform/color_switching_platform.gd.uid rename to game/platform/trigger_color_platform.gd.uid diff --git a/game/platform/color_switching_platform.tscn b/game/platform/trigger_color_platform.tscn similarity index 62% rename from game/platform/color_switching_platform.tscn rename to game/platform/trigger_color_platform.tscn index 22da304..e656bc2 100644 --- a/game/platform/color_switching_platform.tscn +++ b/game/platform/trigger_color_platform.tscn @@ -1,14 +1,14 @@ [gd_scene format=3 uid="uid://bwmd8w677p7k3"] [ext_resource type="PackedScene" uid="uid://wpkj48bqyuy2" path="res://game/platform/abstract_color_platform.tscn" id="1_6jqdv"] -[ext_resource type="Script" uid="uid://b2bityno64bl4" path="res://game/platform/color_switching_platform.gd" id="2_sbqh7"] +[ext_resource type="Script" uid="uid://b2bityno64bl4" path="res://game/platform/trigger_color_platform.gd" id="2_sbqh7"] [ext_resource type="Shader" uid="uid://d4hm3vjx1rhsf" path="res://game/shaders/platform.gdshader" id="2_svoke"] [ext_resource type="Texture2D" uid="uid://cpcuokqv8u2xa" path="res://images/level/platform.png" id="3_sbqh7"] -[sub_resource type="ViewportTexture" id="ViewportTexture_svoke"] +[sub_resource type="ViewportTexture" id="ViewportTexture_ju1s0"] viewport_path = NodePath("SubViewport") -[sub_resource type="ShaderMaterial" id="ShaderMaterial_sbqh7"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_avsyr"] resource_local_to_scene = true shader = ExtResource("2_svoke") shader_parameter/tile_size = 8.0 @@ -16,18 +16,22 @@ shader_parameter/platform_width = 24.0 shader_parameter/atlas = ExtResource("3_sbqh7") shader_parameter/seed = 0.12241629 -[sub_resource type="RectangleShape2D" id="RectangleShape2D_5slkc"] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_i7ji2"] resource_local_to_scene = true size = Vector2(16, 7) -[node name="ColorSwitchingPlatform" unique_id=137546339 instance=ExtResource("1_6jqdv")] +[node name="TriggerColorPlatform" unique_id=137546339 instance=ExtResource("1_6jqdv")] script = ExtResource("2_sbqh7") [node name="Sprite2D" parent="." index="0" unique_id=264863796] -texture = SubResource("ViewportTexture_svoke") +texture = SubResource("ViewportTexture_ju1s0") [node name="PlatformRect" parent="SubViewport" parent_id_path=PackedInt32Array(226200089) index="0" unique_id=794315918] -material = SubResource("ShaderMaterial_sbqh7") +material = SubResource("ShaderMaterial_avsyr") + +[node name="IconSprite" parent="SubViewport" parent_id_path=PackedInt32Array(226200089) index="1" unique_id=1917841765] +animation = &"color_switching" +frame_progress = 0.021697018 [node name="CollisionShape2D" parent="." index="2" unique_id=175449124] -shape = SubResource("RectangleShape2D_5slkc") +shape = SubResource("RectangleShape2D_i7ji2") diff --git a/images/level/platform-icons.png b/images/level/platform-icons.png deleted file mode 100644 index b0d0467..0000000 --- a/images/level/platform-icons.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2bc29eb0ded15408aabfd7d3235118daad730331b2e0d5ebba54ec1c52f4d487 -size 364 diff --git a/images/level/platform_icons.png b/images/level/platform_icons.png new file mode 100644 index 0000000..30e9ba2 --- /dev/null +++ b/images/level/platform_icons.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cdb5f3a02161dccbe2ffe776e6d2e9cab4192b6cc011dd4ee3ad1907258f94c +size 337 diff --git a/images/level/platform-icons.png.import b/images/level/platform_icons.png.import similarity index 75% rename from images/level/platform-icons.png.import rename to images/level/platform_icons.png.import index 062f367..9ec779d 100644 --- a/images/level/platform-icons.png.import +++ b/images/level/platform_icons.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bi2h4g71bro7v" -path="res://.godot/imported/platform-icons.png-9084948edfc829c7eff7f585b0af53a8.ctex" +path="res://.godot/imported/platform_icons.png-a71ab04ace25476f378330b0925db9f3.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://images/level/platform-icons.png" -dest_files=["res://.godot/imported/platform-icons.png-9084948edfc829c7eff7f585b0af53a8.ctex"] +source_file="res://images/level/platform_icons.png" +dest_files=["res://.godot/imported/platform_icons.png-a71ab04ace25476f378330b0925db9f3.ctex"] [params]