plein
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user