FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • Jbox2d simulation runs slowlyZiv the fire
    I wanted to use jbox2d for my project but I have a issue the physics simulation is running very slowly I tried to change game loops and it did not run any faster the best solution I found is still like half the speed it should be game loop code (FPS = 60): double drawInterval = 1000000000/FPS; double delta = 0; long lastTime = System.nanoTime(); long currentTime; while(thread != null) { currentTime = System.nanoTime(); delta+= (currentTime-lastTime)/drawInte
     

Jbox2d simulation runs slowly

I wanted to use jbox2d for my project but I have a issue the physics simulation is running very slowly I tried to change game loops and it did not run any faster the best solution I found is still like half the speed it should be

game loop code (FPS = 60):

    double drawInterval = 1000000000/FPS;
    double delta = 0;
    long lastTime = System.nanoTime();
    long currentTime;
    while(thread != null) {
        currentTime = System.nanoTime();


        delta+= (currentTime-lastTime)/drawInterval;


        float md = (float) (delta/1000000.0);

        lastTime = currentTime;

        if(delta >= 1) {
            world.step((float)delta ,8,3);

            tick(delta);
            System.out.println("e");
            repaint();
            delta--;

        }

    }

Scrolling through more than one image on a plane

If wanted to scroll through more than one image how would I do that? For example: If I had like 3 images and I wanted to scroll through to have a day and night sort of setting, how would I go about that? Thanks!

❌
❌