OverkillManatee / beginning-android-games

Automatically exported from code.google.com/p/beginning-android-games
0 stars 0 forks source link

Game wont reset to world update of .5 sec #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Making the variable tick static will make your game not reset to the proper 
starting tick of .5 if you play multiple games in a row. If your tick has 
gotten to .01 (or whatever the case may be) it will start a new game with that 
value. I would suggest changing it to just float tick = TICK_INITIAL;

public class World {

    static final int WORLD_WIDTH = 10;
    static final int WORLD_HEIGHT = 13;
    static final int SCORE_INCREMENT = 10;
    static final float TICK_INITIAL = 0.5F;
    static final float TICK_DECREMENT = 0.05f;

    public Snake snake;
    public Stain stain;
    public boolean gameOver = false;
    public int score = 0;

    boolean fields[][] = new boolean[WORLD_WIDTH][WORLD_HEIGHT];
    Random rand = new Random();
    float tickTime = 0;
    static float tick = TICK_INITIAL;

Original issue reported on code.google.com by honestgu...@gmail.com on 8 Nov 2011 at 7:20

GoogleCodeExporter commented 9 years ago
Thanks!  Just identified this issue!

Original comment by jdpar...@gmail.com on 22 Feb 2012 at 7:33

GoogleCodeExporter commented 9 years ago
Glad to help.

Original comment by honestgu...@gmail.com on 23 Feb 2012 at 1:22