From 59cb8370cb992a486e152ff75a0d4e3ca656ac45 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 26 Feb 2023 18:31:57 +0100 Subject: [PATCH] update assets + new window --- Assets/warning2/0.png | 4 +-- Assets/warning2/1.png | 4 +-- Assets/warning2/2.png | 4 +-- Assets/warning2/3.png | 4 +-- Assets/windows/window_main.png | 3 ++ Assets/windows/window_main.png.import | 35 +++++++++++++++++++++++ Elements/SquareWindow.tscn | 40 ++++++++++++++++++++++++++- Scenes/DesktopScreen.tscn | 16 +++++------ Scenes/Scripts/Button_Node2D.gd | 4 +-- Scenes/Scripts/Desktop.gd | 28 +++++++++++++++++-- 10 files changed, 120 insertions(+), 22 deletions(-) create mode 100755 Assets/windows/window_main.png create mode 100755 Assets/windows/window_main.png.import diff --git a/Assets/warning2/0.png b/Assets/warning2/0.png index 746e556..b860ea5 100755 --- a/Assets/warning2/0.png +++ b/Assets/warning2/0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6839284e915608d03dd262c07d9961ab29e7a48bb08d70e04ba75f63fbccd107 -size 40722 +oid sha256:1e57beb49fcdf21f6f150b7dc953d596ba4b7d6ef85e25533da6520da4fe0f4e +size 19042 diff --git a/Assets/warning2/1.png b/Assets/warning2/1.png index 8cd2ef4..3d2b5c9 100755 --- a/Assets/warning2/1.png +++ b/Assets/warning2/1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b7e393b98925e9d5bddf34666a2685702424f4dfdc8361cc43ef5fcdada0648 -size 43946 +oid sha256:8f8b551b823e3ac43bf4f65facab06f909722e21cd9889753ad03e220c73a784 +size 23028 diff --git a/Assets/warning2/2.png b/Assets/warning2/2.png index 24543b7..876f8d8 100755 --- a/Assets/warning2/2.png +++ b/Assets/warning2/2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1aa0f8fa226a0c345048e8dbe92ab21412bda19cb15fca3d0d6c02fe6bceba16 -size 45587 +oid sha256:2c15661fb20b707b478c6d0019ad20d30f8f7737d99f91ac3b664fd3934bcf8b +size 25393 diff --git a/Assets/warning2/3.png b/Assets/warning2/3.png index ff3678b..1daf01b 100755 --- a/Assets/warning2/3.png +++ b/Assets/warning2/3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:31f70270bd15c299212d131ede22248a2030038e85d498f011b2d59ed57e5257 -size 45453 +oid sha256:c030e13a062e562afae60b6787abcc842d3cfe6000fb04ae0672e94934642b3c +size 24883 diff --git a/Assets/windows/window_main.png b/Assets/windows/window_main.png new file mode 100755 index 0000000..2beade7 --- /dev/null +++ b/Assets/windows/window_main.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca9d0341fa9a563204d811c7f02492544e8821d9520ab31a939c3d287cff609 +size 321612 diff --git a/Assets/windows/window_main.png.import b/Assets/windows/window_main.png.import new file mode 100755 index 0000000..5e618f5 --- /dev/null +++ b/Assets/windows/window_main.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/window_main.png-7b32d96b4553f4a0a864caadf78c1293.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/windows/window_main.png" +dest_files=[ "res://.import/window_main.png-7b32d96b4553f4a0a864caadf78c1293.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Elements/SquareWindow.tscn b/Elements/SquareWindow.tscn index ac4246b..f6a083d 100755 --- a/Elements/SquareWindow.tscn +++ b/Elements/SquareWindow.tscn @@ -1,7 +1,11 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://Assets/windows/folder_square.png" type="Texture" id=1] [ext_resource path="res://Elements/Scripts/WindowHeader.gd" type="Script" id=2] +[ext_resource path="res://Assets/warning2/1.png" type="Texture" id=3] +[ext_resource path="res://Assets/warning2/2.png" type="Texture" id=4] +[ext_resource path="res://Assets/warning2/3.png" type="Texture" id=5] +[ext_resource path="res://Assets/warning2/0.png" type="Texture" id=6] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 555, 60 ) @@ -9,6 +13,14 @@ extents = Vector2( 555, 60 ) [sub_resource type="RectangleShape2D" id=2] extents = Vector2( 38.75, 38.75 ) +[sub_resource type="SpriteFrames" id=3] +animations = [ { +"frames": [ ExtResource( 6 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ) ], +"loop": true, +"name": "default", +"speed": 5.0 +} ] + [node name="Node2D" type="Node2D"] position = Vector2( 312, 248 ) @@ -33,5 +45,31 @@ script = ExtResource( 2 ) position = Vector2( 486.25, -486.25 ) shape = SubResource( 2 ) +[node name="Window2" type="AnimatedSprite" parent="."] +visible = false +position = Vector2( 56, -12 ) +scale = Vector2( 0.4, 0.4 ) +frames = SubResource( 3 ) +frame = 2 +playing = true + +[node name="Area2D" type="Area2D" parent="Window2"] +position = Vector2( 487.5, -490 ) +script = ExtResource( 2 ) + +[node name="Header" type="CollisionShape2D" parent="Window2/Area2D"] +position = Vector2( -489.5, 171 ) +scale = Vector2( 0.999999, 0.999999 ) +shape = SubResource( 1 ) + +[node name="Area2D2" type="Area2D" parent="Window2"] +script = ExtResource( 2 ) + +[node name="CloseButton" type="CollisionShape2D" parent="Window2/Area2D2"] +position = Vector2( 488, -321 ) +shape = SubResource( 2 ) + [connection signal="input_event" from="Window/Area2D" to="Window/Area2D" method="_on_Area2D_input_event"] [connection signal="input_event" from="Window/Area2D2" to="Window/Area2D" method="_on_Area2D2_input_event"] +[connection signal="input_event" from="Window2/Area2D" to="Window2/Area2D" method="_on_Area2D_input_event"] +[connection signal="input_event" from="Window2/Area2D2" to="Window/Area2D" method="_on_Area2D2_input_event"] diff --git a/Scenes/DesktopScreen.tscn b/Scenes/DesktopScreen.tscn index be84092..a9b5112 100755 --- a/Scenes/DesktopScreen.tscn +++ b/Scenes/DesktopScreen.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=4] [ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=5] [ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=6] -[ext_resource path="res://Assets/windows/windows.png" type="Texture" id=7] +[ext_resource path="res://Assets/windows/window_main.png" type="Texture" id=7] [ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=8] [ext_resource path="res://Elements/SquareWindow.tscn" type="PackedScene" id=9] [ext_resource path="res://Scenes/Scripts/Desktop.gd" type="Script" id=10] @@ -20,8 +20,8 @@ script = ExtResource( 10 ) [node name="Windows" type="Sprite" parent="."] -visible = false -position = Vector2( 512, 358 ) +position = Vector2( 511, 360 ) +scale = Vector2( 0.5, 0.5 ) z_index = -3 texture = ExtResource( 7 ) @@ -29,16 +29,14 @@ texture = ExtResource( 7 ) position = Vector2( 871, 589 ) scale = Vector2( 0.2, 0.2 ) -[node name="Directories" type="Node2D" parent="."] - -[node name="Directory1" parent="Directories" instance=ExtResource( 2 )] +[node name="Directory" parent="." instance=ExtResource( 2 )] position = Vector2( 64, 64 ) -[node name="Screen" parent="Directories/Directory1" instance=ExtResource( 9 )] +[node name="Screen" parent="Directory" instance=ExtResource( 9 )] visible = false position = Vector2( 271, 205 ) -[node name="Button2" type="Button" parent="Directories/Directory1/Screen"] +[node name="Button2" type="Button" parent="Directory/Screen"] margin_left = -128.0 margin_top = -32.0 margin_right = 149.0 @@ -67,4 +65,4 @@ autoplay = true [node name="Alert" type="AudioStreamPlayer" parent="."] stream = ExtResource( 13 ) -[connection signal="pressed" from="Directories/Directory1/Screen/Button2" to="Directories/Directory1/Screen/Button2" method="_on_Button_pressed"] +[connection signal="pressed" from="Directory/Screen/Button2" to="Directory/Screen/Button2" method="_on_Button_pressed"] diff --git a/Scenes/Scripts/Button_Node2D.gd b/Scenes/Scripts/Button_Node2D.gd index c316414..6bb2425 100755 --- a/Scenes/Scripts/Button_Node2D.gd +++ b/Scenes/Scripts/Button_Node2D.gd @@ -1,7 +1,7 @@ extends Button -onready var villain = $"../../../../Villain/AnimatedSprite" -onready var villain_animations = $"../../../../Villain" +onready var villain = $"../../../Villain/AnimatedSprite" +onready var villain_animations = $"../../../Villain" var etat = false var remplissage = 0 diff --git a/Scenes/Scripts/Desktop.gd b/Scenes/Scripts/Desktop.gd index 6338a6e..ef4daac 100755 --- a/Scenes/Scripts/Desktop.gd +++ b/Scenes/Scripts/Desktop.gd @@ -5,17 +5,41 @@ onready var villain_animations = $"Villain" onready var mainMusic = $"MainMusic" onready var eyeMusic = $"EyeMusic" onready var alert = $"Alert" +onready var directory = $"Directory" var rng = RandomNumberGenerator.new() +const texture_file = preload("res://Assets/dossier/1.png") + + # Called when the node enters the scene tree for the first time. func _ready() -> void: rng.randomize() var nbDossier = rng.randi_range(0, 3) for i in range(nbDossier): - var dossier = get_child(2).duplicate() - dossier.get_child(0).get_child(3).get_child(1).focus_mode = Button.FOCUS_NONE + var dossier = directory.duplicate() + var icon = dossier.get_node("Sprite") + var window = dossier.get_node("Screen") + var button_window = window.get_node("Button2") + + # Une chance sur 2 d'avoir une icĂ´ne + if rng.randi_range(0, 1) == 0: + # Text (icon) + var name_icon = dossier.get_node("Label") + name_icon.text = "Fichier" + # Texture (icon) + var scale_icon = 0.35 + icon.scale = Vector2(scale_icon, scale_icon) + icon.texture = texture_file + # Background (window) + window.get_node("Window").visible = false + window.get_node("Window2").visible = true + # Change button text + button_window.text = "." + + + button_window.focus_mode = Button.FOCUS_NONE dossier.position = Vector2(dossier.position.x, dossier.position.y + 150 * (i + 1)) dossier.set_z_index(dossier.get_z_index() + 10 * (i + 1)) add_child(dossier)