let type = 'WebGL',
Application = PIXI.Application,
loader = PIXI.loader,
resources = PIXI.loader.resources,
Sprite = PIXI.Sprite,
Container = PIXI.Container,
Graphics = PIXI.Graphics,
TextureCache = PIXI.utils.TextureCache;
if (!PIXI.utils.isWebGLSupported()) {
type = 'canvas';
}
PIXI.utils.sayHello(type);
let app = new Application({
width: window.innerWidth,
height: window.innerHeight,
antialias: true, //使得字体的边界和几何图形更加圆滑 default: false
transparent: true, //透明度设置 default: false
resolution: 1, // default: 1
});
//游戏场景
gameScene = new Container();
//添加到底层进行显示
app.stage.addChild(gameScene);
//结束场景
gameOverScene = new Container();
app.stage.addChild(gameOverScene);
//游戏结束场景默认不显示
gameOverScene.visible = false;
//引入图片json文件
let id = resources['images/game.json'].textures;
###
这个报错说没有 textures
,而你的代码中涉及这个的只有
let id = resources['images/game.json'].textures;
由此有2种可能
1.本身就没有textures
这个属性(没有完整代码不好评说),比如我觉得这里应该是(注意是texture
而不是textures
):
let id = resources['images/game.json'].texture;
- 语法有问题,对此最安全的语法是:
let id = (resources['images/game.json'])["textures"];
不过就我了解,更可能是1的原因。
###那位大佬能帮忙解决一下,小弟感激不尽