This commit is contained in:
Dukantic
2024-10-25 20:35:40 +02:00
parent 2d1cbb3129
commit b32f61c50e
38 changed files with 1336 additions and 49 deletions

View File

@@ -27,6 +27,7 @@ public partial class Door : Node2D
{
open = true;
Control view = player.GetNode<Control>("Camera2D/door_view");
Input.MouseMode = Input.MouseModeEnum.Visible;
view.Set("text_char", text_char);
view.Set("answerA", answerA);
@@ -36,7 +37,7 @@ public partial class Door : Node2D
view.Set("shot", shot);
view.Set("caniche", caniche);
view.Call("start");
}
}
}
public void BodyEntered(Node2D body)

View File

@@ -122,12 +122,16 @@ public partial class DoorView : Control
public void TrickPressed()
{
trick_bool = true;
int s = (int)menu.Get("spell");
menu.Set("spell", ++s);
text_mob.Text = "-You have casted : " + txt[s-1] + "\n- It : ...?";
butA.Text = "##############";
butB.Text = "##############";
anim.Play("question");
if ((int)menu.Get("spell") < 8)
{
trick_bool = true;
int s = (int)menu.Get("spell");
menu.Set("spell", ++s);
text_mob.Text = "-You have casted : " + txt[s-1] + "\n- It : ...?";
butA.Text = "##############";
butB.Text = "##############";
anim.Play("question");
}
}
}

View File

@@ -1,6 +1,7 @@
using Godot;
using Godot.Collections;
using System;
using System.Threading.Tasks;
public partial class Gameboy : CanvasLayer
{
@@ -27,18 +28,21 @@ public partial class Gameboy : CanvasLayer
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
/*
if (Input.IsActionJustPressed("game"))
{
start();
}
else if (Input.IsActionJustPressed("interact") || Input.IsActionJustPressed("game"))
else if (Input.IsActionJustPressed("game"))
{
stop();
}
*/
}
void start()
async void start()
{
await ToSignal(GetTree().CreateTimer(0.5), "timeout");
Input.MouseMode = Input.MouseModeEnum.Visible;
player.Set("pausable", false);
this.Visible = true;
@@ -53,9 +57,9 @@ public partial class Gameboy : CanvasLayer
void attack()
{
if((int)Cmenu.Get("spell") -1 >= round)
if(round == 8 || (int)Cmenu.Get("spell") -1 >= round)
{
round = (round + 1) % 8;
round = (round + 1) % 9;
anim.Play(round.ToString());
actScore++;
updateScore();

View File

@@ -9,7 +9,7 @@ public partial class Menu : Control
[Export] Panel trick;
[Export] CharacterBody2D player;
Node parent;
int spell {get; set;} = 2;
int spell {get; set;} = 0;
// Called when the node enters the scene tree for the first time.
public override void _Ready()

View File

@@ -18,6 +18,7 @@ public partial class Player : CharacterBody2D
[Export] Sprite2D over;
[Export] CanvasLayer gameover;
[Export] AudioStreamPlayer audio;
[Export] CanvasLayer gameboy;
float minute;
int heure = 18;
@@ -47,6 +48,9 @@ public partial class Player : CharacterBody2D
bool end = false;
bool pausable { get; set; } = true;
bool gam = false;
float mini_time = 0;
public override void _Ready()
{
@@ -58,15 +62,25 @@ public partial class Player : CharacterBody2D
public override void _PhysicsProcess(double delta)
{
Vector2 velocity = Velocity;
if (gam == true && mini_time < 0.5) mini_time += (float)delta;
if (gam == true && mini_time >= 0.5) gam = false;
//GD.Print(gam, mini_time);
if (end == false)
{
sugar -= (float)delta / sugar_speed;
}
}
if (Input.IsActionJustPressed("game"))
{
mini_time = 0;
gam = true;
anim.Play("game");
gameboy.Call("start");
}
bar.Value = sugar;
bar.Value = sugar;
if(sugar <= 5)
{
@@ -134,7 +148,7 @@ public partial class Player : CharacterBody2D
{
anim.Play("up");
}
else
else if (gam == false)
{
anim.Play("idle");