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

@@ -13,11 +13,17 @@ public partial class DoorView : Control
string answerA{get; set;}
string answerB{get; set;}
bool answerA_good {get; set;}
CharacterBody2D player;
[Export] Label text_mob;
[Export] Button butA;
[Export] Button butB;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
player = (CharacterBody2D)GetParent().GetParent();
}
public void start()
{
GetParent<Camera2D>().PositionSmoothingEnabled = false;
@@ -43,4 +49,21 @@ public partial class DoorView : Control
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();
}
}