refactor(hero): 优化英雄缩放逻辑和位置配置
重构英雄缩放逻辑,使用统一的缩放计算方法替代硬编码值 调整英雄和怪物的初始位置坐标 在Hero和Monster类中添加size变量控制缩放
This commit is contained in:
@@ -144,12 +144,12 @@ export class HeroMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
// 只有当朝向真正改变时才更新
|
||||
if (move.currentFacing !== newFacing) {
|
||||
move.currentFacing = newFacing;
|
||||
view.node.setScale(newFacing, 1, 1);
|
||||
view.node.setScale(newFacing*view.node.scale.x, 1*view.node.scale.y);
|
||||
|
||||
// 安全获取top节点
|
||||
const topNode = view.node.getChildByName("top");
|
||||
if (topNode) {
|
||||
topNode.setScale(newFacing, 1, 1);
|
||||
topNode.setScale(newFacing*topNode.scale.x, 1*topNode.scale.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user