validation over 100 coins

This commit is contained in:
Martin Araneda 2022-09-01 23:20:53 -04:00
parent c09c52797c
commit 2c5d3d9afe

View File

@ -30,10 +30,14 @@ void alai::CoinCounter::_ready()
event->connect("coin_collected", this, "_on_coin_collected"); event->connect("coin_collected", this, "_on_coin_collected");
} }
void alai::CoinCounter::_on_coin_collected(int amount) void alai::CoinCounter::_on_coin_collected(int amount)
{ {
coins = coins + amount; coins = coins + amount;
if (coins >= 100)
{
auto extra = coins - 100;
coins = extra;
}
godot::String coin_string = godot::String(); godot::String coin_string = godot::String();
if (coins <= 9) if (coins <= 9)
{ {