mirror of
https://github.com/motajs/template.git
synced 2026-11-11 13:34:31 +08:00
feat: 完善内置特殊属性
This commit is contained in:
1 parent
a0e402728e
commit
3f74d5f25e
10 files changed
+221
-16
No files matched your search
@@ -450,6 +450,21 @@ export class MapLayer
|
||||
this.forEachHook(hook => hook.onUpdateDynamicPosition?.(tile));
|
||||
}
|
||||
|
||||
async moveBlock(
|
||||
x: number,
|
||||
y: number,
|
||||
direction: FaceDirection,
|
||||
count: number = 1,
|
||||
time: number = 500,
|
||||
keepEvent: boolean = true
|
||||
): Promise<void> {
|
||||
const dynamic = this.transferToDynamic(x, y, keepEvent);
|
||||
if (!dynamic) return;
|
||||
dynamic.mover.speed(time).step(direction, count);
|
||||
await dynamic.mover.start()?.onEnd;
|
||||
this.transferToStatic(dynamic, keepEvent);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 开关门
|
||||
|
||||
@@ -552,6 +552,24 @@ export interface IMapLayer
|
||||
*/
|
||||
closeDoor(num: number, x: number, y: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* 朝一个方向移动图块,是先转换成动态图块,再移动,再转换回静态图块的简写,无法进行高级配置
|
||||
* @param x 图块原始横坐标
|
||||
* @param y 图块原始纵坐标
|
||||
* @param direction 图块的移动方向
|
||||
* @param count 图块朝指定方向移动多少步
|
||||
* @param time 每步的移动时长
|
||||
* @param keepEvent 是否维持图块事件
|
||||
*/
|
||||
moveBlock(
|
||||
x: number,
|
||||
y: number,
|
||||
direction: FaceDirection,
|
||||
count?: number,
|
||||
time?: number,
|
||||
keepEvent?: boolean
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
* 获取指定点的点事件视图
|
||||
* @param x 横坐标
|
||||
|
||||
Reference in new issue
Block a user