Cómo crear un juego simple en JAVA | MUY FÁCIL y Rápido | código fuente #1 | Creando la ventana

Sdílet
Vložit
  • čas přidán 13. 09. 2024

Komentáře • 6

  • @sammas2411
    @sammas2411  Před 4 lety +8

    Código Run:
    this.requestFocus();
    long lastTime = System.nanoTime();
    double amountOfTicks = 60.0;
    double ns = 1000000000 / amountOfTicks;
    double delta = 0;
    long timer = System.currentTimeMillis();
    int frames = 0;
    while (running) {
    try {
    long now = System.nanoTime();
    delta += (now - lastTime) / ns;
    lastTime = now;
    while (delta >= 1) {
    delta--;
    }
    if (running)
    paintComponent();
    frames++;
    if (System.currentTimeMillis() - timer > 1000) {
    timer += 1000;
    System.out.println("FPS: " + frames);
    frames = 0;
    }
    } catch (Exception e) {
    System.out.println("Error: " + e.toString());
    }
    }

  • @renzogamallo314
    @renzogamallo314 Před 4 lety +5

    OMG That’s amazing dude!

  • @Srto.Cristo_CH
    @Srto.Cristo_CH Před 3 lety

    Muy buen video:)

  • @piperamirez2519
    @piperamirez2519 Před 3 lety

    Hola cómo podría hablar al privado con usted 🙏😇

  • @seba_tron2736
    @seba_tron2736 Před 2 lety

    Con que teclas se importa