Files
CINC/config/gameConfig.js
T
2026-01-18 02:56:17 +08:00

46 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 导出游戏配置对象,供main.js文件使用
export default {
// 游戏渲染类型:Phaser.AUTO表示自动选择最佳渲染方式(WebGL或Canvas)
type: Phaser.AUTO,
// 游戏窗口宽度:设置为浏览器窗口的宽度
width: window.innerWidth,
// 游戏窗口高度:设置为浏览器窗口的高度
height: window.innerHeight,
// 游戏背景颜色:使用十六进制颜色值设置为天蓝色
backgroundColor: '#87ceeb',
// 输入系统配置
input: {
// 启用多点触控支持
multiTouch: true,
// 触摸事件捕获配置
touch: {
// 捕获触摸事件,防止事件冒泡
capture: true
}
},
// 物理引擎配置
physics: {
// 默认使用的物理引擎:'arcade'是Phaser内置的轻量级物理引擎
default: 'arcade',
// arcade物理引擎的具体配置
arcade: {
// 重力设置:y轴方向重力为0(适合太空或顶部视图游戏)
gravity: { y: 0 },
// 调试模式:false表示关闭物理引擎调试信息显示
debug: false
}
},
// 游戏缩放配置
scale: {
// 缩放模式:Phaser.Scale.RESIZE表示游戏会随着浏览器窗口大小变化而自动调整
mode: Phaser.Scale.RESIZE,
// 自动居中:Phaser.Scale.NO_CENTER表示不自动居中游戏窗口
autoCenter: Phaser.Scale.NO_CENTER,
// 扩展父容器:true表示游戏会扩展到父容器的大小
expandParent: true,
// 缩放后的宽度:设置为浏览器窗口宽度
width: window.innerWidth,
// 缩放后的高度:设置为浏览器窗口高度
height: window.innerHeight
}
};