共享一个八方向触发事件的脚本
事件朝向也改了
另外 不记得素材是怎么设置的 但是用的那个analog move的方向是
7 8 9
4 5 6
1 2 3
目前哥的素材全部按这个方向改的 脚本也是,之前似乎用lz的脚本3/7是反的?
顺便问一下有没有简单的办法在触发事件的时候取消待机动画直接换到初始状态?貌似那个step关掉可以?
//===========================trigger action for diagonal Game_Map.prototype.roundXWithDirection = function(x, d) { return this.roundX(x + (d%3 === 0 ? 1 : (d+2)%3 === 0 ? -1 : 0)); }; Game_Map.prototype.roundYWithDirection = function(y, d) { return this.roundY(y + (d<4 ? 1 : d>6 ? -1 : 0)); }; Game_Character.prototype.turnTowardCharacter = function(character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); var radian = Math.atan2(sx,sy) + Math.PI; this.setDirection( radian < Math.PI / 8.0 * 1.0 ? 2 : radian < Math.PI / 8.0 * 3.0 ? 3 : radian < Math.PI / 8.0 * 5.0 ? 6 : radian < Math.PI / 8.0 * 7.0 ? 9 : radian < Math.PI / 8.0 * 9.0 ? 8 : radian < Math.PI / 8.0 * 11.0 ? 7 : radian < Math.PI / 8.0 * 13.0 ? 4 : radian < Math.PI / 8.0 * 15.0 ? 1 : 2 ); }; Game_Character.prototype.turnAwayFromCharacter = function(character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); var radian = Math.atan2(sx,sy) + Math.PI; this.setDirection( radian < Math.PI / 8.0 * 1.0 ? 8 : radian < Math.PI / 8.0 * 3.0 ? 7 : radian < Math.PI / 8.0 * 5.0 ? 4 : radian < Math.PI / 8.0 * 7.0 ? 1 : radian < Math.PI / 8.0 * 9.0 ? 2 : radian < Math.PI / 8.0 * 11.0 ? 3 : radian < Math.PI / 8.0 * 13.0 ? 6 : radian < Math.PI / 8.0 * 15.0 ? 9 : 8 ); };
//===========================trigger action for diagonal
Game_Map.prototype.roundXWithDirection = function(x, d) {
return this.roundX(x + (d%3 === 0 ? 1 : (d+2)%3 === 0 ? -1 : 0));
};
Game_Map.prototype.roundYWithDirection = function(y, d) {
return this.roundY(y + (d<4 ? 1 : d>6 ? -1 : 0));
};
Game_Character.prototype.turnTowardCharacter = function(character) {
var sx = this.deltaXFrom(character.x);
var sy = this.deltaYFrom(character.y);
var radian = Math.atan2(sx,sy) + Math.PI;
this.setDirection(
radian < Math.PI / 8.0 * 1.0 ? 2 :
radian < Math.PI / 8.0 * 3.0 ? 3 :
radian < Math.PI / 8.0 * 5.0 ? 6 :
radian < Math.PI / 8.0 * 7.0 ? 9 :
radian < Math.PI / 8.0 * 9.0 ? 8 :
radian < Math.PI / 8.0 * 11.0 ? 7 :
radian < Math.PI / 8.0 * 13.0 ? 4 :
radian < Math.PI / 8.0 * 15.0 ? 1 : 2
);
};
Game_Character.prototype.turnAwayFromCharacter = function(character) {
var sx = this.deltaXFrom(character.x);
var sy = this.deltaYFrom(character.y);
var radian = Math.atan2(sx,sy) + Math.PI;
this.setDirection(
radian < Math.PI / 8.0 * 1.0 ? 8 :
radian < Math.PI / 8.0 * 3.0 ? 7 :
radian < Math.PI / 8.0 * 5.0 ? 4 :
radian < Math.PI / 8.0 * 7.0 ? 1 :
radian < Math.PI / 8.0 * 9.0 ? 2 :
radian < Math.PI / 8.0 * 11.0 ? 3 :
radian < Math.PI / 8.0 * 13.0 ? 6 :
radian < Math.PI / 8.0 * 15.0 ? 9 : 8
);
};
|