diff options
| author | ilotterytea <iltsu@alright.party> | 2024-06-09 17:14:03 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-06-09 19:27:54 +0500 |
| commit | 895c1808841ac77bbfb9d08020386d268fcc24f7 (patch) | |
| tree | c4174f94402afc4c199e763572bdac9c7974e0d6 /core/src/kz/ilotterytea/maxon | |
| parent | b417e7a2efa52c94071f084c2e90d54728124505 (diff) | |
feat: add multiplier to the money every 1/10th of second
Diffstat (limited to 'core/src/kz/ilotterytea/maxon')
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/screens/GameScreen.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/src/kz/ilotterytea/maxon/screens/GameScreen.java b/core/src/kz/ilotterytea/maxon/screens/GameScreen.java index 5754dab..01fabb2 100644 --- a/core/src/kz/ilotterytea/maxon/screens/GameScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/GameScreen.java @@ -23,6 +23,7 @@ import kz.ilotterytea.maxon.MaxonGame; import kz.ilotterytea.maxon.anim.SpriteUtils; import kz.ilotterytea.maxon.audio.Playlist; import kz.ilotterytea.maxon.inputprocessors.CrossProcessor; +import kz.ilotterytea.maxon.pets.Pet; import kz.ilotterytea.maxon.player.DecalPlayer; import kz.ilotterytea.maxon.player.MaxonItem; import kz.ilotterytea.maxon.player.MaxonItemRegister; @@ -43,6 +44,7 @@ import net.mgsx.gltf.scene3d.utils.IBLBuilder; import java.util.ArrayList; import java.util.Map; +import java.util.Optional; public class GameScreen implements Screen, InputProcessor { final MaxonGame game; @@ -121,6 +123,31 @@ public class GameScreen implements Screen, InputProcessor { } }, 10, 10)); + // Add a 1/10th multiplier to the money every 1/10th of a second. + tasks.add(Timer.schedule(new Timer.Task() { + @Override + public void run() { + double multiplier = 0.0f; + + for (String id : savegame.getPurchasedPets().keySet()) { + Optional<Pet> pet = game.getPetManager().getPet(id); + + if (pet.isEmpty()) { + continue; + } + + int amount = savegame.getPurchasedPets().get(id); + + double m = pet.get().getMultiplier() * amount; + multiplier += m; + } + + multiplier /= 10f; + + savegame.increaseMoney(multiplier); + } + }, 0.1f, 0.1f)); + camera.update(); render(Gdx.graphics.getDeltaTime()); } |
