presque fini
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
public partial class DoorView : Control
|
||||
{
|
||||
[Export] Sprite2D mob;
|
||||
[Export] AnimationPlayer anim;
|
||||
[Export] Control menu;
|
||||
Texture2D mobTex {get; set;}
|
||||
|
||||
|
||||
@@ -18,20 +20,35 @@ public partial class DoorView : Control
|
||||
bool shot {get; set;}= true;
|
||||
bool caniche {get; set;}= false;
|
||||
|
||||
|
||||
CharacterBody2D player;
|
||||
|
||||
[Export] Label text_mob;
|
||||
[Export] Button butA;
|
||||
[Export] Button butB;
|
||||
|
||||
bool trick_bool = false;
|
||||
|
||||
List<string> txt = new List<string>();
|
||||
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
txt.Add("Black spell of destruction");
|
||||
txt.Add("Necromancy");
|
||||
txt.Add("Freezing Moon");
|
||||
txt.Add("Journey to the stars");
|
||||
txt.Add("The power of souls");
|
||||
txt.Add("Mutilations internes");
|
||||
txt.Add("Manual Breathing");
|
||||
txt.Add("Spectral visions of mental warfare");
|
||||
player = (CharacterBody2D)GetParent().GetParent();
|
||||
}
|
||||
public async void start()
|
||||
{
|
||||
trick_bool = false;
|
||||
GetParent<Camera2D>().PositionSmoothingEnabled = false;
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
GetTree().Paused = true;
|
||||
@@ -45,7 +62,8 @@ public partial class DoorView : Control
|
||||
}
|
||||
else if (caniche)
|
||||
{
|
||||
anim.Play("can");
|
||||
anim.Play("cani");
|
||||
player.Call("OverCanicheAsync");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -55,6 +73,7 @@ public partial class DoorView : Control
|
||||
|
||||
public void stop()
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Hidden;
|
||||
GetParent<Camera2D>().PositionSmoothingEnabled = false;
|
||||
GetTree().Paused = false;
|
||||
Visible = false;
|
||||
@@ -71,7 +90,11 @@ public partial class DoorView : Control
|
||||
|
||||
public void APressed()
|
||||
{
|
||||
if(answerA_good)
|
||||
if(trick_bool)
|
||||
{
|
||||
anim.Play("close");
|
||||
}
|
||||
else if(answerA_good)
|
||||
{
|
||||
player.Set("sugar", (int)player.Get("sugar") + GD.RandRange(20, 40));
|
||||
}
|
||||
@@ -80,10 +103,25 @@ public partial class DoorView : Control
|
||||
|
||||
public void BPressed()
|
||||
{
|
||||
if(!answerA_good)
|
||||
if(trick_bool)
|
||||
{
|
||||
anim.Play("close");
|
||||
}
|
||||
else if(!answerA_good)
|
||||
{
|
||||
player.Set("sugar", (int)player.Get("sugar") + GD.RandRange(20, 40));
|
||||
}
|
||||
stop();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -2,6 +2,7 @@ using Godot;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public partial class Player : CharacterBody2D
|
||||
{
|
||||
@@ -148,8 +149,10 @@ public partial class Player : CharacterBody2D
|
||||
time.Text = string.Format("{0:D2}:{1:D2}", heure, (int)Math.Floor(minute));
|
||||
}
|
||||
|
||||
void OverCaniche()
|
||||
async void OverCanicheAsync()
|
||||
{
|
||||
await ToSignal(GetTree().CreateTimer(3), "timeout");
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
GetTree().Paused = true;
|
||||
audio.Stream = aud_caniche;
|
||||
audio.Play();
|
||||
@@ -160,6 +163,7 @@ public partial class Player : CharacterBody2D
|
||||
async void OverShotgun()
|
||||
{
|
||||
await ToSignal(GetTree().CreateTimer(0.8), "timeout");
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
audio.Stream = aud_shotgun;
|
||||
audio.Play();
|
||||
GetTree().Paused = true;
|
||||
@@ -169,6 +173,7 @@ public partial class Player : CharacterBody2D
|
||||
}
|
||||
void OverCaramel()
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
audio.Stream = aud_caramel;
|
||||
audio.Play();
|
||||
|
||||
@@ -179,6 +184,7 @@ public partial class Player : CharacterBody2D
|
||||
}
|
||||
void OverGlissemie()
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
audio.Stream = aud_glissemie;
|
||||
audio.Play();
|
||||
GetTree().Paused = true;
|
||||
@@ -188,6 +194,7 @@ public partial class Player : CharacterBody2D
|
||||
}
|
||||
void OverVoiture()
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
audio.Stream = aud_voiture;
|
||||
audio.Play();
|
||||
GetTree().Paused = true;
|
||||
@@ -197,6 +204,7 @@ public partial class Player : CharacterBody2D
|
||||
}
|
||||
void OverWin()
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
audio.Stream = aud_win;
|
||||
audio.Play();
|
||||
GetTree().Paused = true;
|
||||
|
||||
@@ -29,6 +29,7 @@ public partial class Principal : Control
|
||||
anim.Play("play2");
|
||||
}else if (enter && Input.IsActionJustPressed("valid"))
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Hidden;
|
||||
//GetTree().Paused = false;
|
||||
parent.Call("ToCityFunc");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user