fix(game): 修复格子正方形和图片尺寸问题,用setDisplaySize精确控制角色图片占一格
This commit is contained in:
@@ -87,10 +87,10 @@ export abstract class EnemyBase {
|
||||
this.y = pathPoints[0].y
|
||||
}
|
||||
|
||||
// 用 AI 图片精灵,尺寸按格子缩放
|
||||
// 用 AI 图片精灵,精确设为格子尺寸的 75%(怪物比塔小一点)
|
||||
const enemySize = cellW * 0.75
|
||||
this.imageSprite = scene.add.image(this.x, this.y, spriteKey)
|
||||
const scale = Math.min(cellW, cellH) / 128 * 0.75
|
||||
this.imageSprite.setScale(scale)
|
||||
this.imageSprite.setDisplaySize(enemySize, enemySize)
|
||||
this.imageSprite.setDepth(10)
|
||||
|
||||
this.healthBar = scene.add.graphics()
|
||||
|
||||
Reference in New Issue
Block a user