本帖最后由 godoway 于 2020-8-27 10:46 编辑
覆盖事件移动的方法,每次移动后都检查就行了吧
大概是这样
const _gameEventMoveStraight = Game_Event.prototype.moveStraight; Game_Event.prototype.moveStraight = function(direction) { _gameEventMoveStraight.call(this, direction); if (this.isMovementSucceeded()) { const x = this._x; const y = this._y; if (this.isCollidedWithPlayerCharacters(x, y) || $gameMap.eventsXy(x, y).length > 1) { console.log('is collided') const events = $gameMap.eventsXyNt(x, y); const effect = events.some(it => { //todo 检查是否存在能激活该事件的事件 return true; }); if (effect) { this.start(); } } } };
const _gameEventMoveStraight = Game_Event.prototype.moveStraight;
Game_Event.prototype.moveStraight = function(direction) {
_gameEventMoveStraight.call(this, direction);
if (this.isMovementSucceeded()) {
const x = this._x;
const y = this._y;
if (this.isCollidedWithPlayerCharacters(x, y) || $gameMap.eventsXy(x, y).length > 1) {
console.log('is collided')
const events = $gameMap.eventsXyNt(x, y);
const effect = events.some(it => {
//todo 检查是否存在能激活该事件的事件
return true;
});
if (effect) {
this.start();
}
}
}
};
|