Merge branch 'develop' into feature/Prototype_R_LEVEL
# Conflicts: # godot/levels/Prototype.tscn
This commit is contained in:
@@ -23,15 +23,24 @@ void alai::CoinCounter::_init()
|
||||
coins = 0;
|
||||
}
|
||||
|
||||
void alai::CoinCounter::_on_coin_collected(int amount)
|
||||
{
|
||||
coins = coins + amount;
|
||||
set_text(godot::String::num(coins));
|
||||
}
|
||||
|
||||
void alai::CoinCounter::_ready()
|
||||
{
|
||||
set_text("0");
|
||||
set_text("00");
|
||||
auto event = get_node<alai::Event>("/root/Event");
|
||||
event->connect("coin_collected", this, "_on_coin_collected");
|
||||
}
|
||||
|
||||
|
||||
void alai::CoinCounter::_on_coin_collected(int amount)
|
||||
{
|
||||
coins = coins + amount;
|
||||
godot::String coin_string = godot::String();
|
||||
if (coins <= 9)
|
||||
{
|
||||
coin_string = "0" + godot::String::num(coins);
|
||||
}
|
||||
else{
|
||||
coin_string = godot::String::num(coins);
|
||||
}
|
||||
set_text(coin_string);
|
||||
}
|
||||
|
Reference in New Issue
Block a user