This commit is contained in:
2024-10-19 19:19:46 +02:00
parent 7c50910690
commit bbf3c5e593
12 changed files with 262 additions and 13 deletions

View File

@@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://c5luwi0ekq5he" uid="uid://dxepey1fkkhhv"
path="res://.godot/imported/back_menu2.png-ce7974e2e9793729e43fcf095529a482.ctex" path="res://.godot/imported/DiabeteMeter1.png-d0b47e401aa5e0df595b747218e9ba7f.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://sound/back_menu2.png" source_file="res://model/DiabeteMeter1.png"
dest_files=["res://.godot/imported/back_menu2.png-ce7974e2e9793729e43fcf095529a482.ctex"] dest_files=["res://.godot/imported/DiabeteMeter1.png-d0b47e401aa5e0df595b747218e9ba7f.ctex"]
[params] [params]

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dqqegt7a6ng06"
path="res://.godot/imported/DiabeteMeter2.png-86d1f7a94d1ff2f1fe83ab0f70468d1b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://model/DiabeteMeter2.png"
dest_files=["res://.godot/imported/DiabeteMeter2.png-86d1f7a94d1ff2f1fe83ab0f70468d1b.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=0

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://mr6hi8icwyle"
path="res://.godot/imported/Trick or treatBG.png-76b8ac899f979f8367c2279bdce07535.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://model/Trick or treatBG.png"
dest_files=["res://.godot/imported/Trick or treatBG.png-76b8ac899f979f8367c2279bdce07535.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

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=33 format=3 uid="uid://bq2yxcm55h7n8"] [gd_scene load_steps=34 format=3 uid="uid://bq2yxcm55h7n8"]
[ext_resource type="Script" path="res://script/DoorView.cs" id="1_nmul8"] [ext_resource type="Script" path="res://script/DoorView.cs" id="1_nmul8"]
[ext_resource type="Texture2D" uid="uid://dpqc1xv3cechw" path="res://model/House1Closed.jpg" id="1_suqi6"] [ext_resource type="Texture2D" uid="uid://dpqc1xv3cechw" path="res://model/House1Closed.jpg" id="1_suqi6"]
@@ -26,6 +26,7 @@
[ext_resource type="Texture2D" uid="uid://drvspvx3dpe8u" path="res://model/frame_18_delay-0.1s.png" id="22_atju4"] [ext_resource type="Texture2D" uid="uid://drvspvx3dpe8u" path="res://model/frame_18_delay-0.1s.png" id="22_atju4"]
[ext_resource type="Texture2D" uid="uid://cggbun65n8uo6" path="res://model/frame_19_delay-0.1s.png" id="23_l4jpt"] [ext_resource type="Texture2D" uid="uid://cggbun65n8uo6" path="res://model/frame_19_delay-0.1s.png" id="23_l4jpt"]
[ext_resource type="Texture2D" uid="uid://ob3tlldg8ta" path="res://model/frame_20_delay-0.1s.png" id="24_tjfip"] [ext_resource type="Texture2D" uid="uid://ob3tlldg8ta" path="res://model/frame_20_delay-0.1s.png" id="24_tjfip"]
[ext_resource type="AudioStream" uid="uid://blgk5pv3ydewn" path="res://sound/toc.mp3" id="26_7kpao"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jooqt"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jooqt"]
@@ -310,8 +311,8 @@ script = ExtResource("1_nmul8")
mob = NodePath("Panel/mob") mob = NodePath("Panel/mob")
anim = NodePath("AnimationPlayer") anim = NodePath("AnimationPlayer")
text_mob = NodePath("Question/Label") text_mob = NodePath("Question/Label")
butA = NodePath("Question/Button") butA = NodePath("Question/a")
butB = NodePath("Question/Button2") butB = NodePath("Question/b")
[node name="Panel" type="Panel" parent="."] [node name="Panel" type="Panel" parent="."]
layout_mode = 1 layout_mode = 1
@@ -343,6 +344,7 @@ libraries = {
} }
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("26_7kpao")
[node name="Trick" type="VBoxContainer" parent="."] [node name="Trick" type="VBoxContainer" parent="."]
visible = false visible = false
@@ -398,14 +400,14 @@ theme_override_font_sizes/font_size = 18
text = "Trick or treat salut a tous les amis moi c'est davide la farge pokemon" text = "Trick or treat salut a tous les amis moi c'est davide la farge pokemon"
autowrap_mode = 2 autowrap_mode = 2
[node name="Button" type="Button" parent="Question"] [node name="a" type="Button" parent="Question"]
custom_minimum_size = Vector2(128.58, 0) custom_minimum_size = Vector2(128.58, 0)
layout_mode = 2 layout_mode = 2
theme = ExtResource("5_50q8s") theme = ExtResource("5_50q8s")
theme_override_font_sizes/font_size = 18 theme_override_font_sizes/font_size = 18
text = "Trick" text = "Trick"
[node name="Button2" type="Button" parent="Question"] [node name="b" type="Button" parent="Question"]
layout_mode = 2 layout_mode = 2
theme = ExtResource("5_50q8s") theme = ExtResource("5_50q8s")
theme_override_font_sizes/font_size = 18 theme_override_font_sizes/font_size = 18
@@ -413,4 +415,5 @@ text = "Treat
" "
[connection signal="pressed" from="Trick/Button2" to="." method="TreatPressed"] [connection signal="pressed" from="Trick/Button2" to="." method="TreatPressed"]
[connection signal="pressed" from="Question/Button2" to="." method="TreatPressed"] [connection signal="pressed" from="Question/a" to="." method="APressed"]
[connection signal="pressed" from="Question/b" to="." method="BPressed"]

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=31 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="Script" path="res://script/Player.cs" id="1_gmlsd"]
[ext_resource type="Texture2D" uid="uid://bo4q2rvn056p3" path="res://model/PatrickIdle1.png" id="2_w2lj6"] [ext_resource type="Texture2D" uid="uid://bo4q2rvn056p3" path="res://model/PatrickIdle1.png" id="2_w2lj6"]
@@ -12,7 +12,9 @@
[ext_resource type="Texture2D" uid="uid://bu5nnr2x4co38" path="res://model/PatrickLeft2.png" id="6_jii6b"] [ext_resource type="Texture2D" uid="uid://bu5nnr2x4co38" path="res://model/PatrickLeft2.png" id="6_jii6b"]
[ext_resource type="Texture2D" uid="uid://doavv8drnetm" path="res://model/PatrickRight1.png" id="7_xptin"] [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://dbey2oeyhxsq8" path="res://model/PatrickRight2.png" id="8_m32jm"]
[ext_resource type="Texture2D" uid="uid://dxepey1fkkhhv" path="res://model/DiabeteMeter1.png" id="9_0ohl3"]
[ext_resource type="Texture2D" uid="uid://c0oqqh7qgohu" path="res://model/PatrickBack1.png" id="9_y1wtp"] [ext_resource type="Texture2D" uid="uid://c0oqqh7qgohu" path="res://model/PatrickBack1.png" id="9_y1wtp"]
[ext_resource type="Texture2D" uid="uid://dqqegt7a6ng06" path="res://model/DiabeteMeter2.png" id="10_ete3q"]
[ext_resource type="Texture2D" uid="uid://dgs1topxer4a8" path="res://model/PatrickBack2.png" id="10_rvawd"] [ext_resource type="Texture2D" uid="uid://dgs1topxer4a8" path="res://model/PatrickBack2.png" id="10_rvawd"]
[ext_resource type="Texture2D" uid="uid://cisefnb0eej45" path="res://model/Patrickfront1.png" id="11_wpam5"] [ext_resource type="Texture2D" uid="uid://cisefnb0eej45" path="res://model/Patrickfront1.png" id="11_wpam5"]
[ext_resource type="Texture2D" uid="uid://bex6put0xmadj" path="res://model/Patrickfront2.png" id="12_t0eem"] [ext_resource type="Texture2D" uid="uid://bex6put0xmadj" path="res://model/Patrickfront2.png" id="12_t0eem"]
@@ -354,13 +356,15 @@ _data = {
"up": SubResource("Animation_7twwg") "up": SubResource("Animation_7twwg")
} }
[node name="CharacterBody2D" type="CharacterBody2D" node_paths=PackedStringArray("anim", "cam", "menu")] [node name="CharacterBody2D" type="CharacterBody2D" node_paths=PackedStringArray("anim", "cam", "bar", "menu")]
position = Vector2(1, 1) position = Vector2(1, 1)
motion_mode = 1 motion_mode = 1
script = ExtResource("1_gmlsd") script = ExtResource("1_gmlsd")
Speed = 6000.0 Speed = 6000.0
sugar_speed = 2.0
anim = NodePath("anim") anim = NodePath("anim")
cam = NodePath("Camera2D") cam = NodePath("Camera2D")
bar = NodePath("diabetmeter")
menu = NodePath("Camera2D/menu") menu = NodePath("Camera2D/menu")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
@@ -371,6 +375,23 @@ shape = SubResource("RectangleShape2D_2homw")
position = Vector2(2, 1) position = Vector2(2, 1)
texture = ExtResource("2_w2lj6") texture = ExtResource("2_w2lj6")
[node name="diabetmeter" type="TextureProgressBar" parent="."]
texture_filter = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 162.0
offset_top = -121.0
offset_right = 192.0
offset_bottom = 129.0
grow_horizontal = 2
grow_vertical = 2
step = 0.01
value = 50.0
fill_mode = 3
texture_under = ExtResource("9_0ohl3")
texture_progress = ExtResource("10_ete3q")
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="."]
process_mode = 3 process_mode = 3
limit_smoothed = true limit_smoothed = true

75
scene/principal.tscn Normal file
View File

@@ -0,0 +1,75 @@
[gd_scene load_steps=6 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"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qdt6c"]
bg_color = Color(0, 0, 0, 0.792157)
[node name="Principal" type="Control" node_paths=PackedStringArray("sub")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_5hpqm")
sub = NodePath("sub")
play = ExtResource("2_qp7s0")
[node name="TrickOrTreatBg" type="Sprite2D" parent="."]
texture = ExtResource("1_4oira")
centered = false
[node name="Enter" type="Button" parent="."]
layout_mode = 0
offset_left = 24.0
offset_top = 238.0
offset_right = 121.0
offset_bottom = 290.0
theme = ExtResource("2_ab0tu")
theme_override_font_sizes/font_size = 42
text = "Enter"
[node name="sub" type="Panel" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_qdt6c")
[node name="Play" type="Button" parent="sub"]
layout_mode = 0
offset_left = 284.0
offset_top = 53.0
offset_right = 343.0
offset_bottom = 91.0
theme = ExtResource("2_ab0tu")
text = "Play
"
[node name="Credits" type="Button" parent="sub"]
layout_mode = 0
offset_left = 247.0
offset_top = 149.0
offset_right = 338.0
offset_bottom = 187.0
theme = ExtResource("2_ab0tu")
text = "Credits"
[node name="Exit" type="Button" parent="sub"]
layout_mode = 0
offset_left = 181.0
offset_top = 230.0
offset_right = 233.0
offset_bottom = 268.0
theme = ExtResource("2_ab0tu")
text = "Exit
"
[connection signal="pressed" from="Enter" to="." method="EnterPressed"]

View File

@@ -13,11 +13,17 @@ public partial class DoorView : Control
string answerA{get; set;} string answerA{get; set;}
string answerB{get; set;} string answerB{get; set;}
bool answerA_good {get; set;} bool answerA_good {get; set;}
CharacterBody2D player;
[Export] Label text_mob; [Export] Label text_mob;
[Export] Button butA; [Export] Button butA;
[Export] Button butB; [Export] Button butB;
// Called when the node enters the scene tree for the first time. // Called when the node enters the scene tree for the first time.
public override void _Ready()
{
player = (CharacterBody2D)GetParent().GetParent();
}
public void start() public void start()
{ {
GetParent<Camera2D>().PositionSmoothingEnabled = false; GetParent<Camera2D>().PositionSmoothingEnabled = false;
@@ -43,4 +49,21 @@ public partial class DoorView : Control
butB.Text = answerB; butB.Text = answerB;
} }
public void APressed()
{
if(answerA_good)
{
player.Set("sugar", (int)player.Get("sugar") + GD.RandRange(20, 40));
}
stop();
}
public void BPressed()
{
if(!answerA_good)
{
player.Set("sugar", (int)player.Get("sugar") + GD.RandRange(20, 40));
}
stop();
}
} }

View File

@@ -4,19 +4,35 @@ using System;
public partial class Player : CharacterBody2D public partial class Player : CharacterBody2D
{ {
[Export] float Speed; [Export] float Speed;
[Export] float sugar_speed;
[Export] AnimationPlayer anim; [Export] AnimationPlayer anim;
[Export] Camera2D cam; [Export] Camera2D cam;
[Export] TextureProgressBar bar;
[ExportGroup("controls")] [ExportGroup("controls")]
[Export] Control menu; [Export] Control menu;
public float PixelSize = 1.0f; public float PixelSize = 1.0f;
float sugar { get; set;}= 50;
const float MAX_SUGAR = 100;
public override void _PhysicsProcess(double delta) public override void _PhysicsProcess(double delta)
{ {
Vector2 velocity = Velocity; Vector2 velocity = Velocity;
sugar -= (float)delta / sugar_speed;
bar.Value = sugar;
if(sugar <= 0)
{
}
else if (sugar >= 100)
{
}
Vector2 direction = Input.GetVector("left", "right", "up", "down"); Vector2 direction = Input.GetVector("left", "right", "up", "down");

24
script/Principal.cs Normal file
View File

@@ -0,0 +1,24 @@
using Godot;
using System;
public partial class Principal : Control
{
[Export] Panel sub;
[Export] PackedScene play;
[Export] PackedScene credit;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void EnterPressed()
{
sub.Visible = true;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

19
sound/toc.mp3.import Normal file
View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://blgk5pv3ydewn"
path="res://.godot/imported/toc.mp3-2735aa5520ec9e4f3f689c5400a40c21.mp3str"
[deps]
source_file="res://sound/toc.mp3"
dest_files=["res://.godot/imported/toc.mp3-2735aa5520ec9e4f3f689c5400a40c21.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4