javascript - 为什么 Phaser 3 中的图像没有变化?
问题描述
我尝试为我的游戏背景加载图像。
let gameState = {};
function preload() {
this.load.image('background', 'assets/background.png');
}
function create() {
gameState.background = this.add.tileSprite(480, 270, 'background').setScale(0.5);
}
function update() {
}
let config = {
type: Phaser.AUTO,
width: 960,
height: 540,
physics: {
default: 'arcade',
arcade: {
gravity: { y: 500 },
debug: false
}
},
scene: {
preload,
create,
update
}
};
let game = new Phaser.Game(config);
但是,如果我删除加载和添加图像的行,即使我没有在代码中的任何地方提到图像,图像仍然会留在屏幕上。
如何删除图像?
解决方案
推荐阅读
- javascript - 如何使用按钮重定向到查询链接?
- javascript - 无法完成实时搜索查询
- debugging - 在 GDB 中的特定地址设置挂起断点
- css - CSS 幻灯片启动时间过长
- powershell - 当所有正在运行的进程“console exe”完成后继续执行
- php - 如何在 Laravel 查询中使用 LIKE 运算符和 AND 运算符
- vscode-remote - vscode-remote 中的多个开发容器
- google-cloud-platform - GCP 中的流水线
- c - 我的代码在第一次输入 scanf 后停止运行
- c++ - 为什么 make_shared 在不同的调用中分配相同的地址?