加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
战斗的时候使用$gameParty.setFormationID改变坐标时,不能及时刷新角色位置,有什么办法能及时刷新一下变更后的位置么?还请大佬们指点一下
新人刚刚学习一点点js,下面代码写的可能很粗糙。。。。
(() => { //设置角色阵型的哈希,键为阵型ID,值为角色坐标 let Actor_Pos = { //散开阵 0: [[595, 172], [615, 228], [635, 284], [655, 340], [675, 396]], //鹤翼阵 1: [[675, 172], [675, 228], [721, 284], [675, 340], [675, 396]], }; //初始化阵型id const UncleJay_Formation_initialize = Game_Party.prototype.initialize Game_Party.prototype.initialize = function() { UncleJay_Formation_initialize.call(this); this._formation = 0; }; //获取阵型id Game_Party.prototype.formation = function() { return this._formation; }; //设置阵型id Game_Party.prototype.setFormationID = function(num) { this._formation = num; }; //战斗画面下角色坐标的设置 Sprite_Actor.prototype.setActorHome = function(index) { const id = $gameParty.formation(); const x = Actor_Pos[id][index][0]; const y = Actor_Pos[id][index][1]; this.setHome(x, y); }; })();
(() => {
//设置角色阵型的哈希,键为阵型ID,值为角色坐标
let Actor_Pos = {
//散开阵
0: [[595, 172],
[615, 228],
[635, 284],
[655, 340],
[675, 396]],
//鹤翼阵
1: [[675, 172],
[675, 228],
[721, 284],
[675, 340],
[675, 396]],
};
//初始化阵型id
const UncleJay_Formation_initialize = Game_Party.prototype.initialize
Game_Party.prototype.initialize = function() {
UncleJay_Formation_initialize.call(this);
this._formation = 0;
};
//获取阵型id
Game_Party.prototype.formation = function() {
return this._formation;
};
//设置阵型id
Game_Party.prototype.setFormationID = function(num) {
this._formation = num;
};
//战斗画面下角色坐标的设置
Sprite_Actor.prototype.setActorHome = function(index) {
const id = $gameParty.formation();
const x = Actor_Pos[id][index][0];
const y = Actor_Pos[id][index][1];
this.setHome(x, y);
};
})();
|