add score in Screen libgdx
Clash Royale CLAN TAG #URR8PPP add score in Screen libgdx I have a sprite that collides with obstacle, but i have a problem with the score in the top of my screen. In the update of my class, The collisions are specified by an array, but when it collides with an object, the score is still growing and I can not stop it. this is my code: private Array<Polen> polen; private Score score; public PlayState(GameStateManager gsm) super(gsm); score = new Score(110, 310); polen = new Array<Polen>(); for(int i = 1; i <= COUNT; i++) polen.add(new Polen(i * (Polen.WIDTH))); @Override public void update(float dt) handleInput(); for(int i = 0; i < polen.size; i++) Polen pol= polen.get(i); if(pol.collides(aliado.getBounds())) pol.changeExplosion(); flagScore = 1; if (pol.collides(aliado.getBounds())==false) flagScore = 0; if (flagScore == 1) Score.count++; flagScore=0; //auxCount = Score.count +1; score.update(dt); updateGround(); cam.update(); Score...