Multidimensional Array Movement

Thanks for the help :slight_smile:
Really Appreciated :slight_smile:

Using SKIP_TICKS doesnt work :s, if i pass next_game_tick it works but they move down the screen too fast.

Maybe something is wrong. Hereโ€™s my game loop.


/**
 * Implements the game loop. User mustn't call this method.
 */
public final void run()
{
    // Game loop initialization
    long now = getCurrentTime();
    long step_size = 1000 / Global.STEPS_FOR_SECOND;
    long game_time = getCurrentTime();

    // FPS counter
    int frames = 0;
    long lastFPSCount = getCurrentTime();

    // UPD counter
    int updates = 0;
    long lastUPDCount = getCurrentTime();

    // Frame-skips
    int loops = 0;

    while (running)
    {
        loops = 0;
        now = getCurrentTime();

        while (now > game_time && loops < 2)
        {
            updateGame(1000 / Global.ACTUAL_STEPS_FOR_SECOND);
            game_time += step_size;

            // calculate update count
            updates++;
            loops++;

            if (now - lastUPDCount > 1000)
            {
                lastUPDCount = now;
                Global.ACTUAL_STEPS_FOR_SECOND = updates;
                updates = 0;
            }
        }
        displayGame();

        // FPS counter
        frames++;

        if (now - lastFPSCount > 1000)
        {
            lastFPSCount = now;
            Global.FRAMES_PER_SECOND = frames;
            frames = 0;
        }
    }
}

Itโ€™s similar to yours but it works for me.

Nope, the aliens just move until they hit they bottom.

All i want is for them to move periodically, why does something so simple in concept turn out to be complicated? :confused:

Concept would be:

  1. Move Down
  2. Wait Duration Of Delay
  3. Move Down

loop until game ends :S