Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

218
Vistas
phaser 3 throws "Texture.frame missing:" warning and fails to load frame, how do I fix it?

Note: my code is already running and rendering the sprite

just one click to play with


I'm learning a phaser3 loader example

here is the code I wrote

class BootScene extends Phaser.Scene {
  constructor() {
    super();
  }
  preload() {
    this.load.path = 'https://raw.githubusercontent.com/liyi93319/phaser3_rpg/main/part1/assets/';
    this.load.atlas('player', 'knight_atlas.png', 'knight_atlas.json');
  }
  create() {
    var player = this.add.sprite(80, 100, 'player', 0);
    player.setScale(.5);
  }
}

var config = {
  width: 400,
  height: 300,
  pixelArt: true,
  physics: {
    default: 'arcade',
    arcade: {
      gravity: { y: 0 },
    }
  },
  backgroundColor: 0x000000,
  scene: [BootScene]
}

var game = new Phaser.Game(config);
<script src="https://cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>

Everything works fine so far.

However, changing the create() as follows

  create() {
    var player = this.add.sprite(80, 100, 'player', 5);
    player.setScale(.5);
  }

doesn't load the frame as expected and throws a warning

Texture.frame missing: 5

I compared the 'knight_atlas.json' file with the one from the official example. I don't see the difference.

I also checked the doc but didn't find a solution.

What am I missing?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you want to use the third parameter you would have to use the string (or Texture Object), in this case the filename from the atlas should work. Here the is relevant documentation

class BootScene extends Phaser.Scene {
  constructor() {
    super();
  }
  preload() {
    this.load.path = 'https://raw.githubusercontent.com/liyi93319/phaser3_rpg/main/part1/assets/';
    this.load.atlas('player', 'knight_atlas.png', 'knight_atlas.json');
  }
  create() {
    var player = this.add.sprite(80, 100, 'player', 'Attack (3).png');
    player.setScale(.5);
    
    var player2 = this.add.sprite(240, 100, 'player', 'Idle10');
    player2.setScale(.5);
  }
}

var config = {
  width: 400,
  height: 300,
  pixelArt: true,
  physics: {
    default: 'arcade',
    arcade: {
      gravity: { y: 0 },
    }
  },
  backgroundColor: 0x000000,
  scene: [BootScene]
}

var game = new Phaser.Game(config);
<script src="https://cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda