【RPG Maker MV 仿新仙剑 战斗场景UI (四)】

2024-03-16 00:04

本文主要是介绍【RPG Maker MV 仿新仙剑 战斗场景UI (四)】,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

RPG Maker MV 仿新仙剑 战斗场景UI 四

  • 三级战斗指令菜单
    • 效果
      • 代码
      • 完成效果
  • 下篇预告

三级战斗指令菜单

仙剑1中三级战斗的菜单内容如下:使用、投掷、装备这三项。

效果

在RMMV中原始菜单中是没有这三级菜单的,因此需要重新进行添加进去。

代码

这里贴上完整的代码。。。

Pal_Scene_Battle.prototype.isAnyInputWindowActive = function() {return (this._partyCommandWindow.active ||this._actorCommandWindow.active ||this._otherCommandWindow.active ||this._itemCommandWindow.active ||this._skillWindow.active ||this._itemWindow.active ||this._actorWindow.active ||this._enemyWindow.active);
};

isAnyInputWindowActive 方法的判断中继续添加新的变量判断,将物品指令菜单的激活变量加入进去。

Pal_Scene_Battle.prototype.changeInputWindow = function() {if (BattleManager.isInputting()) {if (BattleManager.actor()) {if(this._otherCommandWindow.active||this._itemCommandWindow.active){if(this._itemCommandWindow.active){this.startItemCommandSelection();}else{this.startOtherCommandSelection();}}else{this.startActorCommandSelection();}} else {this.startPartyCommandSelection();}} else {this.endCommandSelection();}
};

changeInputWindow 方法的判断中将额外和物品指令窗口的放在一起啊确保窗口打开是按照正确的顺序进行,然后再单独判断物品指令窗口是否激活。

Pal_Scene_Battle.prototype.createAllWindows = function() {this.createLogWindow();this.createStatusWindow();this.createPartyCommandWindow();		this.createActorCommandWindow();this.createOtherCommandWindow();this.createItemCommandWindow();this.createHelpWindow();this.createSkillWindow();this.createItemWindow();this.createActorWindow();this.createEnemyWindow();this.createMessageWindow();this.createScrollTextWindow();
};
Pal_Scene_Battle.prototype.createItemCommandWindow = function() {this._itemCommandWindow = new Window_ItemCommand();this._itemCommandWindow.setHandler('use', this.commandAttack.bind(this));this._itemCommandWindow.setHandler('throw',  this.commandAttack.bind(this));this._itemCommandWindow.setHandler('equip',  this.commandAttack.bind(this));this._itemCommandWindow.setHandler('cancel', this.selectItemCancelCommand.bind(this));//this._otherCommandWindow.changeTransparent();//this._actorCommandWindow.setHandler('escape', this.commandEscape.bind(this));this.addWindow(this._itemCommandWindow);
};

createItemCommandWindow 方法创建了物品指令菜单,并在createAllWindows 方法中添加进去物品指令菜单的创建方法。

Pal_Scene_Battle.prototype.startItemCommandSelection = function() {this._itemCommandWindow.setup(BattleManager.actor());
};
Pal_Scene_Battle.prototype.commandItem = function() {this._itemCommandWindow.activate();this.selectNextCommand2();
};
Pal_Scene_Battle.prototype.selectItemCancelCommand = function() {this._itemCommandWindow.close();this._otherCommandWindow.activate();this.selectPreviousCommand2();
};

这三个方法和上一篇中的额外指令操作方法一致,这里不再赘述,只需要换个操作的窗口即可。

function Window_ItemCommand() {this.initialize.apply(this, arguments);
}Window_ItemCommand.prototype = Object.create(Window_Command.prototype);
Window_ItemCommand.prototype.constructor = Window_ItemCommand;Window_ItemCommand.prototype.initialize = function() {var y = Graphics.boxHeight - this.windowHeight();Window_Command.prototype.initialize.call(this, 0, y);this.move(70, 158, 128, 160);this.BattleCommand= ImageManager.loadSystem('FightItem');this.openness = 0;this.deactivate();this._actor = null;
};Window_ItemCommand.prototype.windowWidth = function() {return 128;
};Window_ItemCommand.prototype.numVisibleRows = function() {return 5;
};
//标准内边距
Window_ItemCommand.prototype.standardPadding = function() {return 0;
};//创建命令列表
Window_ItemCommand.prototype.makeCommandList = function() {if (this._actor) {this.addUseCommand();this.addThrowCommands();this.addJointAttackCommand();}
};
//添加道具使用命令
Window_ItemCommand.prototype.addUseCommand = function() {this.addCommand("使用", 'use', this._actor.canAttack());
};
//添加投掷命令
Window_ItemCommand.prototype.addThrowCommands = function() {this.addCommand("投掷", 'throw', this._actor.canAttack());
};
//添加装备命令
Window_ItemCommand.prototype.addJointAttackCommand = function() {this.addCommand(TextManager.equip, 'equip', this._actor.canAttack());
};Window_ItemCommand.prototype.setup = function(actor) {this._actor = actor;this.clearCommandList();this.makeCommandList();this.refresh();this.selectLast();this.activate();this.open();
};Window_ItemCommand.prototype.update=function(){Window_Base.prototype.update.call(this);this.processCursorMove();this.processHandling();this._stayCount++;this.refresh();
}Window_ItemCommand.prototype.refresh=function(){this.contents.clear();if(this._actor){this.drawBattleItemCommand();}
}Window_ItemCommand.prototype.drawSx=new Map([[0,0],[1,128],[2,256]
]);Window_ItemCommand.prototype.drawBattleItemCommand=function(){var bitmap=this.BattleCommand;var sy=0;var sw=128;var sh=160;var dx=0;var dy=0;this.contents.blt(bitmap, this.drawSx.get(this._index), sy, sw, sh, dx, dy);
}Window_ItemCommand.prototype.processOk = function() {if (this._actor) {if (ConfigManager.commandRemember) {this._actor.setLastCommandSymbol(this.currentSymbol());} else {this._actor.setLastCommandSymbol('');}}Window_Command.prototype.processOk.call(this);
};Window_ItemCommand.prototype.selectLast = function() {this.select(0);if (this._actor && ConfigManager.commandRemember) {var symbol = this._actor.lastCommandSymbol();this.selectSymbol(symbol);if (symbol === 'skill') {var skill = this._actor.lastBattleSkill();if (skill) {this.selectExt(skill.stypeId);}}}
};

这里由于复制使用了额外指令的代码,因此内容大同小异,但都可以看到行数那边数值与正常的有区别,那是进行对应的计算,但若修改后会发现绘制的图片被遮挡了,因此需要增大。

完成效果

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述
在这里插入图片描述
这样具体的效果就完成了,这和原版仙剑可以说是一致的,当然现在还没有完成全部的UI效果,因此无法看到全部的完整的游戏效果出来。这里只要在创建窗口时将窗口背景透明,看着就更好了,现在暂时不做,不然不好进行其他的定位。

下篇预告

下一篇章进行的内容,会在战斗的状态菜单,法术菜单、物品菜单。装备菜单及状态菜单中选择一个进行开发制作,或是开始处理人物状态行走的相关开发,这也是一个大头的!!!

这篇关于【RPG Maker MV 仿新仙剑 战斗场景UI (四)】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/813701

相关文章

Java字符串操作技巧之语法、示例与应用场景分析

《Java字符串操作技巧之语法、示例与应用场景分析》在Java算法题和日常开发中,字符串处理是必备的核心技能,本文全面梳理Java中字符串的常用操作语法,结合代码示例、应用场景和避坑指南,可快速掌握字... 目录引言1. 基础操作1.1 创建字符串1.2 获取长度1.3 访问字符2. 字符串处理2.1 子字

SpringBoot应用中出现的Full GC问题的场景与解决

《SpringBoot应用中出现的FullGC问题的场景与解决》这篇文章主要为大家详细介绍了SpringBoot应用中出现的FullGC问题的场景与解决方法,文中的示例代码讲解详细,感兴趣的小伙伴可... 目录Full GC的原理与触发条件原理触发条件对Spring Boot应用的影响示例代码优化建议结论F

SpringBoot条件注解核心作用与使用场景详解

《SpringBoot条件注解核心作用与使用场景详解》SpringBoot的条件注解为开发者提供了强大的动态配置能力,理解其原理和适用场景是构建灵活、可扩展应用的关键,本文将系统梳理所有常用的条件注... 目录引言一、条件注解的核心机制二、SpringBoot内置条件注解详解1、@ConditionalOn

Python 迭代器和生成器概念及场景分析

《Python迭代器和生成器概念及场景分析》yield是Python中实现惰性计算和协程的核心工具,结合send()、throw()、close()等方法,能够构建高效、灵活的数据流和控制流模型,这... 目录迭代器的介绍自定义迭代器省略的迭代器生产器的介绍yield的普通用法yield的高级用法yidle

C++ Sort函数使用场景分析

《C++Sort函数使用场景分析》sort函数是algorithm库下的一个函数,sort函数是不稳定的,即大小相同的元素在排序后相对顺序可能发生改变,如果某些场景需要保持相同元素间的相对顺序,可使... 目录C++ Sort函数详解一、sort函数调用的两种方式二、sort函数使用场景三、sort函数排序

kotlin中const 和val的区别及使用场景分析

《kotlin中const和val的区别及使用场景分析》在Kotlin中,const和val都是用来声明常量的,但它们的使用场景和功能有所不同,下面给大家介绍kotlin中const和val的区别,... 目录kotlin中const 和val的区别1. val:2. const:二 代码示例1 Java

Java中&和&&以及|和||的区别、应用场景和代码示例

《Java中&和&&以及|和||的区别、应用场景和代码示例》:本文主要介绍Java中的逻辑运算符&、&&、|和||的区别,包括它们在布尔和整数类型上的应用,文中通过代码介绍的非常详细,需要的朋友可... 目录前言1. & 和 &&代码示例2. | 和 ||代码示例3. 为什么要使用 & 和 | 而不是总是使

Java中Runnable和Callable的区别和联系及使用场景

《Java中Runnable和Callable的区别和联系及使用场景》Java多线程有两个重要的接口,Runnable和Callable,分别提供一个run方法和call方法,二者是有较大差异的,本文... 目录一、Runnable使用场景二、Callable的使用场景三、关于Future和FutureTa

JavaScript中的reduce方法执行过程、使用场景及进阶用法

《JavaScript中的reduce方法执行过程、使用场景及进阶用法》:本文主要介绍JavaScript中的reduce方法执行过程、使用场景及进阶用法的相关资料,reduce是JavaScri... 目录1. 什么是reduce2. reduce语法2.1 语法2.2 参数说明3. reduce执行过程

JavaScript中的isTrusted属性及其应用场景详解

《JavaScript中的isTrusted属性及其应用场景详解》在现代Web开发中,JavaScript是构建交互式应用的核心语言,随着前端技术的不断发展,开发者需要处理越来越多的复杂场景,例如事件... 目录引言一、问题背景二、isTrusted 属性的来源与作用1. isTrusted 的定义2. 为