From 44e659f454db7e85f24511123733d0dfc4722d9c Mon Sep 17 00:00:00 2001 From: LUCASTUCIOUS Date: Sun, 28 Jul 2024 22:24:01 +0200 Subject: [PATCH] fix BG --- core/Background.tscn | 53 ++++++++++++++++++++++++++------------- core/player.tscn | 10 ++++++-- maps/map1.tscn | 2 -- prefab/solid_sticker.tscn | 1 - project.godot | 6 ----- 5 files changed, 43 insertions(+), 29 deletions(-) diff --git a/core/Background.tscn b/core/Background.tscn index 17a60e5..6bce601 100644 --- a/core/Background.tscn +++ b/core/Background.tscn @@ -1,26 +1,34 @@ -[gd_scene load_steps=2 format=3 uid="uid://bj15crtyjwq2"] +[gd_scene load_steps=3 format=3 uid="uid://bxin06eifwhb5"] [ext_resource type="Texture2D" uid="uid://dx8jpmxtm2cdx" path="res://textures/pattern/Pattern_Forest.png" id="1_wdsuj"] -[node name="Control" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 +[sub_resource type="GDScript" id="GDScript_7jd0b"] +script/source = "@tool +extends CanvasLayer -[node name="Panel" type="Panel" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 +@export var Pattern :Texture2D: + set(new_pattern): + Pattern = new_pattern + $TextureRect.texture = Pattern + $TextureRect.queue_redraw() +@export var PatternColor :Color = Color.WHITE: + set(new_patternColor): + PatternColor = new_patternColor + $TextureRect.self_modulate = PatternColor + $TextureRect.queue_redraw() +@export var BGColor :Color = Color.GRAY: + set(new_BGColor): + BGColor = new_BGColor + $ColorRect.color = BGColor + $ColorRect.queue_redraw() +" -[node name="TextureRect" type="TextureRect" parent="Panel"] -top_level = true -layout_mode = 1 +[node name="Background" type="CanvasLayer"] +layer = -100 +script = SubResource("GDScript_7jd0b") + +[node name="TextureRect" type="TextureRect" parent="."] +light_mask = 0 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -28,3 +36,12 @@ grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_wdsuj") stretch_mode = 1 + +[node name="ColorRect" type="ColorRect" parent="."] +z_index = -1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 1) diff --git a/core/player.tscn b/core/player.tscn index 42875ed..4a13dd1 100644 --- a/core/player.tscn +++ b/core/player.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=21 format=3 uid="uid://0m1hk2nu4bps"] +[gd_scene load_steps=23 format=3 uid="uid://0m1hk2nu4bps"] [ext_resource type="Script" path="res://core/player.gd" id="1_whhfc"] [ext_resource type="Texture2D" uid="uid://5pmqr3y62guu" path="res://textures/player/currentCloth.tres" id="2_w1l4c"] [ext_resource type="Texture2D" uid="uid://5qixrbrclydr" path="res://textures/player/currentHat.tres" id="3_ybl0v"] [ext_resource type="Animation" uid="uid://bd0mi2x4pkf70" path="res://animations/player/Walk.res" id="4_56ghs"] +[ext_resource type="PackedScene" uid="uid://bxin06eifwhb5" path="res://core/Background.tscn" id="4_vpr5c"] +[ext_resource type="Texture2D" uid="uid://cr27nsk1jw2ks" path="res://textures/pattern/Pattern_swamp.png" id="5_moipb"] [ext_resource type="Animation" uid="uid://b85dikp6ps8i2" path="res://animations/player/idle.res" id="5_uweie"] [ext_resource type="Texture2D" uid="uid://sod0ms1cfkjf" path="res://textures/player/playerSkin_ref.png" id="6_3ryww"] @@ -509,7 +511,6 @@ position = Vector2(0, -75) shape = SubResource("RectangleShape2D_kapu3") [node name="Camera2D" type="Camera2D" parent="."] -enabled = false zoom = Vector2(0.13, 0.13) position_smoothing_enabled = true position_smoothing_speed = 2.0 @@ -522,6 +523,11 @@ drag_bottom_margin = 0.74 editor_draw_limits = true editor_draw_drag_margin = true +[node name="Background" parent="Camera2D" instance=ExtResource("4_vpr5c")] +Pattern = ExtResource("5_moipb") +PatternColor = Color(1, 1, 1, 0.490196) +BGColor = Color(0.173374, 0.319037, 0.221103, 1) + [node name="AnimationPlayer" type="AnimationPlayer" parent="." groups=["Animation"]] libraries = { "": SubResource("AnimationLibrary_4k813") diff --git a/maps/map1.tscn b/maps/map1.tscn index b88da46..87088ad 100644 --- a/maps/map1.tscn +++ b/maps/map1.tscn @@ -234,7 +234,6 @@ texture = SubResource("AtlasTexture_vun1v") offset = Vector2(-78.385, -130.2) StickerShape = SubResource("CapsuleShape2D_b3366") Position = Vector2(8.56, -52.395) -Rotation = 0.0 CollisionShape = SubResource("RectangleShape2D_4cdlc") CollisionPosition = Vector2(7.915, -31.39) metadata/tags = ["rock"] @@ -245,7 +244,6 @@ texture = SubResource("AtlasTexture_wpoj4") offset = Vector2(-126.11, -220.56) StickerShape = SubResource("CapsuleShape2D_bkpsv") Position = Vector2(0, -89.77) -Rotation = 0.0 CollisionShape = SubResource("RectangleShape2D_hk5e3") CollisionPosition = Vector2(0, -66.02) metadata/tags = ["rock"] diff --git a/prefab/solid_sticker.tscn b/prefab/solid_sticker.tscn index 59f39cc..b4730f5 100644 --- a/prefab/solid_sticker.tscn +++ b/prefab/solid_sticker.tscn @@ -55,7 +55,6 @@ texture = SubResource("AtlasTexture_2wdar") centered = false offset = Vector2(-161.055, -179.785) script = SubResource("GDScript_uqtu8") -Rotation = Vector2(0, 0) metadata/tags = ["sticker"] [node name="Area2D" type="Area2D" parent="."] diff --git a/project.godot b/project.godot index 220597e..64e7445 100644 --- a/project.godot +++ b/project.godot @@ -20,12 +20,6 @@ config/windows_native_icon="res://extracted/Texture2D/Map.png" [autoload] DebugDraw="*res://core/debugDraw.tscn" -Background="*res://core/Background.tscn" - -[display] - -window/size/viewport_width=1920 -window/size/viewport_height=1080 [editor_plugins]