phaser 3 throws "Texture.frame missing:" warning and fails to load frame, how do I fix it? [duplicate]
Solution 1:
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/[email protected]/dist/phaser.js"></script>