Added TriggerColorPlatform

This commit is contained in:
2026-06-20 16:01:15 +03:00
parent 0a8c9a8163
commit 04cbca0ce1
13 changed files with 77 additions and 63 deletions
+1 -1
View File
@@ -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"]
+1 -1
View File
@@ -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
-2
View File
@@ -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)
+2 -44
View File
@@ -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)
+10
View File
@@ -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
@@ -0,0 +1 @@
uid://d2xfxje428psp
+43
View File
@@ -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)
@@ -1,5 +1,5 @@
@tool
class_name ColorSwitchingPlatform
class_name TriggerColorPlatform
extends AbstractColorPlatform
@@ -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")
Binary file not shown.
Binary file not shown.
@@ -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]