diff --git a/model/Car1.png.import b/model/Car1.png.import new file mode 100644 index 0000000..bd2dc83 --- /dev/null +++ b/model/Car1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cdunb77p5rpwa" +path="res://.godot/imported/Car1.png-fb058f1749727e9d1262d2ea69ddb392.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Car1.png" +dest_files=["res://.godot/imported/Car1.png-fb058f1749727e9d1262d2ea69ddb392.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/model/Car2.png.import b/model/Car2.png.import new file mode 100644 index 0000000..64ca20f --- /dev/null +++ b/model/Car2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cmtpp8aejspqd" +path="res://.godot/imported/Car2.png-687e66777bda54014b2b0caf5bc2df59.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Car2.png" +dest_files=["res://.godot/imported/Car2.png-687e66777bda54014b2b0caf5bc2df59.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/model/Car3.png.import b/model/Car3.png.import new file mode 100644 index 0000000..84b3bf3 --- /dev/null +++ b/model/Car3.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d3bxjeob51psa" +path="res://.godot/imported/Car3.png-8b0e16b9ac49f4d491c87dfadc8219aa.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Car3.png" +dest_files=["res://.godot/imported/Car3.png-8b0e16b9ac49f4d491c87dfadc8219aa.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/model/Car4.png.import b/model/Car4.png.import new file mode 100644 index 0000000..3fe594a --- /dev/null +++ b/model/Car4.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://br6gyyxy5yo2e" +path="res://.godot/imported/Car4.png-b732dd9c3dc2f72a5fb63f9b9d653f9c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Car4.png" +dest_files=["res://.godot/imported/Car4.png-b732dd9c3dc2f72a5fb63f9b9d653f9c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/model/Car5.png.import b/model/Car5.png.import new file mode 100644 index 0000000..48209da --- /dev/null +++ b/model/Car5.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8vfx50pepr6q" +path="res://.godot/imported/Car5.png-bcbf69a7a17e3fa546fd29d6899a5159.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Car5.png" +dest_files=["res://.godot/imported/Car5.png-bcbf69a7a17e3fa546fd29d6899a5159.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/model/Car6.png.import b/model/Car6.png.import new file mode 100644 index 0000000..cd5ee28 --- /dev/null +++ b/model/Car6.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d0tovjqwhq5xy" +path="res://.godot/imported/Car6.png-733f8482d306f586ac32480d37582dd4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Car6.png" +dest_files=["res://.godot/imported/Car6.png-733f8482d306f586ac32480d37582dd4.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/project.godot b/project.godot index 2e39c7b..ba7e2d7 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Mal-Adresse" -run/main_scene="res://scene/principal.tscn" +run/main_scene="res://scene/scene_manager.tscn" config/features=PackedStringArray("4.3", "C#", "Forward Plus") config/icon="res://icon.svg" diff --git a/scene/player.tscn b/scene/player.tscn index 8081f2f..c40de2d 100644 --- a/scene/player.tscn +++ b/scene/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=34 format=3 uid="uid://4ubk6w44h4s2"] +[gd_scene load_steps=33 format=3 uid="uid://4ubk6w44h4s2"] [ext_resource type="Script" path="res://script/Player.cs" id="1_gmlsd"] [ext_resource type="Texture2D" uid="uid://bo4q2rvn056p3" path="res://model/PatrickIdle1.png" id="2_w2lj6"] @@ -10,7 +10,6 @@ [ext_resource type="Texture2D" uid="uid://b5mfnew4kh6ht" path="res://model/PatrickLeft1.png" id="5_vnnjt"] [ext_resource type="Texture2D" uid="uid://dyi5a1hlwio71" path="res://model/Glitch4.png" id="6_73f32"] [ext_resource type="Texture2D" uid="uid://bu5nnr2x4co38" path="res://model/PatrickLeft2.png" id="6_jii6b"] -[ext_resource type="PackedScene" uid="uid://cru3yl7laeiem" path="res://scene/principal.tscn" id="6_plp4a"] [ext_resource type="Texture2D" uid="uid://doavv8drnetm" path="res://model/PatrickRight1.png" id="7_xptin"] [ext_resource type="Texture2D" uid="uid://dbey2oeyhxsq8" path="res://model/PatrickRight2.png" id="8_m32jm"] [ext_resource type="Texture2D" uid="uid://dxepey1fkkhhv" path="res://model/DiabeteMeter1.png" id="9_0ohl3"] @@ -399,7 +398,7 @@ limit_smoothed = true position_smoothing_enabled = true rotation_smoothing_speed = 7.0 -[node name="menu" parent="Camera2D" node_paths=PackedStringArray("anim") instance=ExtResource("3_6uvd0")] +[node name="menu" parent="Camera2D" node_paths=PackedStringArray("anim", "player") instance=ExtResource("3_6uvd0")] visible = false offset_left = -47.0 offset_top = -60.0 @@ -407,7 +406,7 @@ offset_right = -47.0 offset_bottom = -60.0 scale = Vector2(0.334, 0.334) anim = NodePath("../../anim") -principal = ExtResource("6_plp4a") +player = NodePath("../..") [node name="door_view" parent="Camera2D" instance=ExtResource("4_0vwed")] visible = false diff --git a/scene/principal.tscn b/scene/principal.tscn index 68de002..5f82747 100644 --- a/scene/principal.tscn +++ b/scene/principal.tscn @@ -1,9 +1,8 @@ -[gd_scene load_steps=9 format=3 uid="uid://cru3yl7laeiem"] +[gd_scene load_steps=8 format=3 uid="uid://cru3yl7laeiem"] [ext_resource type="Texture2D" uid="uid://mr6hi8icwyle" path="res://model/Trick or treatBG.png" id="1_4oira"] [ext_resource type="Script" path="res://script/Principal.cs" id="1_5hpqm"] [ext_resource type="Theme" uid="uid://depo4fa5p8k8m" path="res://themes/button.tres" id="2_ab0tu"] -[ext_resource type="PackedScene" uid="uid://1tfopbwug3ht" path="res://scene/city.tscn" id="2_qp7s0"] [ext_resource type="StyleBox" uid="uid://cl1mx7tnohwg6" path="res://themes/back_principal.tres" id="5_tyto3"] [ext_resource type="Texture2D" uid="uid://cf12hst5y4gfr" path="res://model/Credit.png" id="6_px85q"] @@ -23,7 +22,6 @@ grow_vertical = 2 script = ExtResource("1_5hpqm") sub = NodePath("sub") credit = NodePath("credit") -play = ExtResource("2_qp7s0") [node name="TrickOrTreatBg" type="Sprite2D" parent="."] texture = ExtResource("1_4oira") diff --git a/scene/scene_manager.tscn b/scene/scene_manager.tscn new file mode 100644 index 0000000..8d16170 --- /dev/null +++ b/scene/scene_manager.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://chc2do7pc6ews"] + +[ext_resource type="Script" path="res://script/SceneManager.cs" id="1_mayof"] + +[node name="SceneManager" type="Node"] +script = ExtResource("1_mayof") diff --git a/script/Menu.cs b/script/Menu.cs index ac5f7a1..cc985b2 100644 --- a/script/Menu.cs +++ b/script/Menu.cs @@ -6,10 +6,13 @@ public partial class Menu : Control [Export] AnimationPlayer anim; [Export] Panel pause; [Export] Panel trick; - [Export] PackedScene principal; + [Export] CharacterBody2D player; + Node parent; + // Called when the node enters the scene tree for the first time. public override void _Ready() { + parent = player.GetParent().GetParent(); } // Called every frame. 'delta' is the elapsed time since the previous frame. @@ -32,7 +35,10 @@ public partial class Menu : Control public void ExitDown() { - GetTree().ChangeSceneToPacked(principal); + GetTree().Paused = false; + parent.Call("ToPrincipalFunc"); + //EmitSignal("ToPrincipalEventHandler"); + //GetTree().ChangeSceneToPacked(principal); } public void Res() diff --git a/script/Player.cs b/script/Player.cs index cbabecc..4aa2cfd 100644 --- a/script/Player.cs +++ b/script/Player.cs @@ -10,7 +10,7 @@ public partial class Player : CharacterBody2D [Export] TextureProgressBar bar; [ExportGroup("controls")] [Export] Control menu; - [Export] PackedScene principal; + diff --git a/script/Principal.cs b/script/Principal.cs index 18c46f0..6daf605 100644 --- a/script/Principal.cs +++ b/script/Principal.cs @@ -5,12 +5,14 @@ public partial class Principal : Control { [Export] Panel sub; [Export] Panel credit; - [Export] PackedScene play; + + Node parent; // Called when the node enters the scene tree for the first time. public override void _Ready() { - + parent = GetParent(); + sub.Visible = false; } // Called every frame. 'delta' is the elapsed time since the previous frame. @@ -20,6 +22,7 @@ public partial class Principal : Control public void EnterPressed() { + GD.Print("wefwef"); sub.Visible = true; } @@ -37,7 +40,9 @@ public partial class Principal : Control public void PlayPressed() { - GetTree().ChangeSceneToPacked(play); + parent.Call("ToCityFunc"); + //EmitSignal("ToCityEventHandler"); + //GetTree().ChangeSceneToPacked(play); } public void ExitGlobPressed() diff --git a/script/SceneManager.cs b/script/SceneManager.cs new file mode 100644 index 0000000..2bc2f4a --- /dev/null +++ b/script/SceneManager.cs @@ -0,0 +1,43 @@ +using Godot; +using System; + +public partial class SceneManager : Node +{ + PackedScene principal ; + PackedScene city; + Node actuel; + + + [Signal] public delegate void ToPrincipalEventHandler(); + [Signal] public delegate void ToCityEventHandler(); + // Called when the node enters the scene tree for the first time. + public override void _Ready() + { + Callable PrincipalCallable = new Callable(this, MethodName.ToPrincipalFunc); + Connect(SignalName.ToPrincipal, PrincipalCallable); + + Callable CityCallable = new Callable(this, MethodName.ToCityFunc); + Connect(SignalName.ToCity, CityCallable); + + + principal = (PackedScene)ResourceLoader.Load("res://scene/principal.tscn"); + city = (PackedScene)ResourceLoader.Load("res://scene/city.tscn"); + actuel = principal.Instantiate(); + AddChild(actuel); + + } + + public void ToPrincipalFunc() + { + actuel.QueueFree(); + actuel = principal.Instantiate(); + AddChild(actuel); + } + + public void ToCityFunc() + { + actuel.QueueFree(); + actuel = city.Instantiate(); + AddChild(actuel); + } +}