Fixed platform shader

This commit is contained in:
2026-06-12 01:20:45 +03:00
parent 0c7e0f7c74
commit e72e17f7ca
12 changed files with 92 additions and 84 deletions
@@ -1,5 +1,5 @@
@tool
class_name AbstractColoredPlatform
class_name AbstractColorPlatform
extends AbstractPlatform
@@ -1,18 +1,18 @@
[gd_scene format=3 uid="uid://wpkj48bqyuy2"]
[ext_resource type="PackedScene" uid="uid://guvijso3k6eq" path="res://game/platform/abstract_platform.tscn" id="1_8ogjv"]
[ext_resource type="Script" uid="uid://6hn6ncbqe6cn" path="res://game/platform/abstract_colored_platform.gd" id="2_3iy2o"]
[ext_resource type="Shader" uid="uid://d4hm3vjx1rhsf" path="res://game/shaders/platform.gdshader" id="2_jpqbs"]
[ext_resource type="Texture2D" uid="uid://cpcuokqv8u2xa" path="res://images/level/platform.png" id="3_3iy2o"]
[ext_resource type="Material" uid="uid://d2o2o1w8kb51g" path="res://game/materials/walls_white.tres" id="3_6pvc3"]
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="5_3iy2o"]
[ext_resource type="PackedScene" uid="uid://guvijso3k6eq" path="res://game/platform/abstract_platform.tscn" id="1_ovkrd"]
[ext_resource type="Script" uid="uid://6hn6ncbqe6cn" path="res://game/platform/abstract_color_platform.gd" id="2_vbsvi"]
[ext_resource type="Material" uid="uid://bkmfkjkwnquil" path="res://game/materials/platform_color.tres" id="3_pbfpg"]
[ext_resource type="Shader" uid="uid://d4hm3vjx1rhsf" path="res://game/shaders/platform.gdshader" id="4_cdhfe"]
[ext_resource type="Texture2D" uid="uid://cpcuokqv8u2xa" path="res://images/level/platform.png" id="5_uk0x1"]
[ext_resource type="PackedScene" uid="uid://5qlocc0yu8ug" path="res://game/collision_switcher.tscn" id="6_mk014"]
[sub_resource type="ViewportTexture" id="ViewportTexture_majud"]
[sub_resource type="ViewportTexture" id="ViewportTexture_ovkrd"]
viewport_path = NodePath("SubViewport")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gfbtg"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vbsvi"]
resource_local_to_scene = true
shader = ExtResource("2_jpqbs")
shader = ExtResource("4_cdhfe")
shader_parameter/black_color = Color(0, 0, 0, 1)
shader_parameter/white_color = Color(1, 1, 1, 1)
shader_parameter/switch_colors = false
@@ -22,26 +22,26 @@ shader_parameter/intensity = 1.0
shader_parameter/scale = 20.0
shader_parameter/tile_size = 8.0
shader_parameter/platform_width = 24.0
shader_parameter/atlas = ExtResource("3_3iy2o")
shader_parameter/seed = 0.23701711
shader_parameter/atlas = ExtResource("5_uk0x1")
shader_parameter/seed = 0.12241629
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2p7w0"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pbfpg"]
resource_local_to_scene = true
size = Vector2(16, 7)
[node name="AbstractColoredPlatform" unique_id=137546339 instance=ExtResource("1_8ogjv")]
[node name="AbstractColorPlatform" unique_id=137546339 instance=ExtResource("1_ovkrd")]
collision_layer = 32
script = ExtResource("2_3iy2o")
script = ExtResource("2_vbsvi")
[node name="Sprite2D" parent="." index="0" unique_id=264863796]
material = ExtResource("3_6pvc3")
texture = SubResource("ViewportTexture_majud")
material = ExtResource("3_pbfpg")
texture = SubResource("ViewportTexture_ovkrd")
[node name="PlatformRect" parent="SubViewport" parent_id_path=PackedInt32Array(226200089) index="0" unique_id=794315918]
material = SubResource("ShaderMaterial_gfbtg")
material = SubResource("ShaderMaterial_vbsvi")
[node name="CollisionShape2D" parent="." index="2" unique_id=175449124]
shape = SubResource("RectangleShape2D_2p7w0")
shape = SubResource("RectangleShape2D_pbfpg")
[node name="CollisionSwitcher" parent="." index="3" unique_id=542648449 node_paths=PackedStringArray("object") instance=ExtResource("5_3iy2o")]
[node name="CollisionSwitcher" parent="." index="3" unique_id=542648449 node_paths=PackedStringArray("object") instance=ExtResource("6_mk014")]
object = NodePath("..")
+1 -1
View File
@@ -30,7 +30,7 @@ func _ready() -> void:
func rebuild_platform() -> void:
var shape := collision.shape as RectangleShape2D
shape.size = Vector2(platform_width, TILE_SIZE)
shape.size.x = platform_width
sub_viewport.size = Vector2(platform_width, TILE_SIZE)
platform_rect.size.x = platform_width
+2 -9
View File
@@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://guvijso3k6eq"]
[ext_resource type="Script" uid="uid://kjy0t56tgpxs" path="res://game/platform/abstract_platform.gd" id="1_426vp"]
[ext_resource type="Material" uid="uid://dojhoc6ljpt1a" path="res://game/materials/walls_gray.tres" id="2_2ivtb"]
[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"]
@@ -11,17 +11,10 @@ viewport_path = NodePath("SubViewport")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2ivtb"]
resource_local_to_scene = true
shader = ExtResource("2_jsq8n")
shader_parameter/black_color = Color(0, 0, 0, 1)
shader_parameter/white_color = Color(1, 1, 1, 1)
shader_parameter/switch_colors = false
shader_parameter/threshold = 0.5
shader_parameter/speed = 0.5
shader_parameter/intensity = 1.0
shader_parameter/scale = 20.0
shader_parameter/tile_size = 8.0
shader_parameter/platform_width = 24.0
shader_parameter/atlas = ExtResource("2_31xwx")
shader_parameter/seed = 0.7482483
shader_parameter/seed = 0.1415489
[sub_resource type="RectangleShape2D" id="RectangleShape2D_jsq8n"]
resource_local_to_scene = true