From 097581635630d7b5a4abd5229d5d50d6960847ad Mon Sep 17 00:00:00 2001 From: Dukantic Date: Mon, 28 Oct 2024 21:53:03 +0100 Subject: [PATCH] v1.1 --- scene/city.tscn | 18 ++++++------ scene/principal.tscn | 70 ++++++++++++++++++++++++++++++++++++++++++-- script/Principal.cs | 14 ++++++--- 3 files changed, 87 insertions(+), 15 deletions(-) diff --git a/scene/city.tscn b/scene/city.tscn index 5e6611c..e4ad6da 100644 --- a/scene/city.tscn +++ b/scene/city.tscn @@ -865,6 +865,14 @@ answerB = "Ours" caniche = true image_mob = ExtResource("10_xtvfi") +[node name="door53" parent="door_special" instance=ExtResource("5_rvft3")] +position = Vector2(3361, 2112) +text_char = "Do you love halloween ?" +answerA = "! False" +answerB = "! True" +answerA_good = true +image_mob = ExtResource("27_t0apm") + [node name="door52" parent="door_special" instance=ExtResource("5_rvft3")] position = Vector2(2489, 2014) text_char = "qwertyuiop" @@ -1080,14 +1088,6 @@ answerA = "A" answerB = "B" answerA_good = true -[node name="door52" parent="doors" instance=ExtResource("5_rvft3")] -position = Vector2(3361, 2112) -text_char = "Do you love halloween ?" -answerA = "! False" -answerB = "! True" -answerA_good = true -image_mob = ExtResource("27_t0apm") - [node name="door24" parent="doors" instance=ExtResource("5_rvft3")] position = Vector2(2490, 29) text_char = "With the lights out, is it less dangerous ?" @@ -2015,7 +2015,7 @@ scale = Vector2(-1, 1) texture = ExtResource("16_ssypi") [node name="CharacterBody2D" parent="." instance=ExtResource("2_nmm2d")] -position = Vector2(1385, 1600) +position = Vector2(3302, 2112) [editable path="Flash/Path2D/PathFollow2D2/Car"] [editable path="Flash/Path2D/PathFollow2D3/Car"] diff --git a/scene/principal.tscn b/scene/principal.tscn index ec8d379..214ad59 100644 --- a/scene/principal.tscn +++ b/scene/principal.tscn @@ -1,14 +1,17 @@ -[gd_scene load_steps=11 format=3 uid="uid://cru3yl7laeiem"] +[gd_scene load_steps=14 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="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"] +[ext_resource type="Texture2D" uid="uid://k1l7jsf0akl5" path="res://model/Controls.jpg" id="6_rk6ub"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_luosh"] bg_color = Color(0, 0, 0, 0.745098) +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_m0qij"] + [sub_resource type="Animation" id="Animation_fe1ic"] length = 0.001 tracks/0/type = "value" @@ -71,6 +74,30 @@ tracks/4/keys = { "update": 0, "values": [Color(1, 1, 1, 0)] } +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("explication:modulate") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} +tracks/6/type = "value" +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/path = NodePath("control:modulate") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 0)] +} [sub_resource type="Animation" id="Animation_5wj8t"] resource_name = "play" @@ -152,11 +179,39 @@ tracks/1/keys = { "values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] } +[sub_resource type="Animation" id="Animation_wxt3w"] +resource_name = "play3" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("explication:modulate") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0.0666667, 0.933333), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("control:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.966667), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] +} + [sub_resource type="AnimationLibrary" id="AnimationLibrary_l2600"] _data = { "RESET": SubResource("Animation_fe1ic"), "play": SubResource("Animation_5wj8t"), -"play2": SubResource("Animation_arta6") +"play2": SubResource("Animation_arta6"), +"play3": SubResource("Animation_wxt3w") } [node name="Principal" type="Control" node_paths=PackedStringArray("sub", "credit", "anim")] @@ -304,6 +359,17 @@ offset_bottom = 293.0 theme = ExtResource("2_ab0tu") text = "Enter..." +[node name="control" type="Panel" parent="."] +modulate = Color(1, 1, 1, 0) +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 +theme_override_styles/panel = SubResource("StyleBoxEmpty_m0qij") + +[node name="Sprite2D" type="Sprite2D" parent="control"] +texture = ExtResource("6_rk6ub") +centered = false + [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { "": SubResource("AnimationLibrary_l2600") diff --git a/script/Principal.cs b/script/Principal.cs index f9cee2e..733fb44 100644 --- a/script/Principal.cs +++ b/script/Principal.cs @@ -8,6 +8,7 @@ public partial class Principal : Control [Export] AnimationPlayer anim; bool play_pressed = false; bool enter = false; + bool touch = false; Node parent; @@ -18,8 +19,8 @@ public partial class Principal : Control GetTree().Paused = false; parent = GetParent(); sub.Visible = false; - - } + + } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) @@ -28,12 +29,17 @@ public partial class Principal : Control { enter = true; anim.Play("play2"); - }else if (enter && Input.IsActionJustPressed("valid")) + }else if (enter && Input.IsActionJustPressed("valid") && ! touch) + { + + touch = true; + anim.Play("play3"); + }else if (touch && Input.IsActionJustPressed("valid")) { Input.MouseMode = Input.MouseModeEnum.Hidden; - parent.Call("ToCityFunc"); } + }