战斗的时候使用$gameParty.setFormationID改变坐标时,不能及时刷新角色位置,有什么办法能及时刷新一下变更后的位置么?还请大佬们指点一下
新人刚刚学习一点点js,下面代码写的可能很粗糙。。。。
JAVASCRIPT 代码 - (() => {
- //设置角色阵型的哈希,键为阵型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);
- };
- })();
复制代码
本帖来自P1论坛作者流浪杰哥,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=484208 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。 |