【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

相关文章

nginx -t、nginx -s stop 和 nginx -s reload 命令的详细解析(结合应用场景)

《nginx-t、nginx-sstop和nginx-sreload命令的详细解析(结合应用场景)》本文解析Nginx的-t、-sstop、-sreload命令,分别用于配置语法检... 以下是关于 nginx -t、nginx -s stop 和 nginx -s reload 命令的详细解析,结合实际应

Android kotlin中 Channel 和 Flow 的区别和选择使用场景分析

《Androidkotlin中Channel和Flow的区别和选择使用场景分析》Kotlin协程中,Flow是冷数据流,按需触发,适合响应式数据处理;Channel是热数据流,持续发送,支持... 目录一、基本概念界定FlowChannel二、核心特性对比数据生产触发条件生产与消费的关系背压处理机制生命周期

MyBatis-Plus 中 nested() 与 and() 方法详解(最佳实践场景)

《MyBatis-Plus中nested()与and()方法详解(最佳实践场景)》在MyBatis-Plus的条件构造器中,nested()和and()都是用于构建复杂查询条件的关键方法,但... 目录MyBATis-Plus 中nested()与and()方法详解一、核心区别对比二、方法详解1.and()

ModelMapper基本使用和常见场景示例详解

《ModelMapper基本使用和常见场景示例详解》ModelMapper是Java对象映射库,支持自动映射、自定义规则、集合转换及高级配置(如匹配策略、转换器),可集成SpringBoot,减少样板... 目录1. 添加依赖2. 基本用法示例:简单对象映射3. 自定义映射规则4. 集合映射5. 高级配置匹

python中Hash使用场景分析

《python中Hash使用场景分析》Python的hash()函数用于获取对象哈希值,常用于字典和集合,不可变类型可哈希,可变类型不可,常见算法包括除法、乘法、平方取中和随机数哈希,各有优缺点,需根... 目录python中的 Hash除法哈希算法乘法哈希算法平方取中法随机数哈希算法小结在Python中,

Python主动抛出异常的各种用法和场景分析

《Python主动抛出异常的各种用法和场景分析》在Python中,我们不仅可以捕获和处理异常,还可以主动抛出异常,也就是以类的方式自定义错误的类型和提示信息,这在编程中非常有用,下面我将详细解释主动抛... 目录一、为什么要主动抛出异常?二、基本语法:raise关键字基本示例三、raise的多种用法1. 抛

Spring组件实例化扩展点之InstantiationAwareBeanPostProcessor使用场景解析

《Spring组件实例化扩展点之InstantiationAwareBeanPostProcessor使用场景解析》InstantiationAwareBeanPostProcessor是Spring... 目录一、什么是InstantiationAwareBeanPostProcessor?二、核心方法解

Java 枚举的基本使用方法及实际使用场景

《Java枚举的基本使用方法及实际使用场景》枚举是Java中一种特殊的类,用于定义一组固定的常量,枚举类型提供了更好的类型安全性和可读性,适用于需要定义一组有限且固定的值的场景,本文给大家介绍Jav... 目录一、什么是枚举?二、枚举的基本使用方法定义枚举三、实际使用场景代替常量状态机四、更多用法1.实现接

java -jar命令运行 jar包时运行外部依赖jar包的场景分析

《java-jar命令运行jar包时运行外部依赖jar包的场景分析》:本文主要介绍java-jar命令运行jar包时运行外部依赖jar包的场景分析,本文给大家介绍的非常详细,对大家的学习或工作... 目录Java -jar命令运行 jar包时如何运行外部依赖jar包场景:解决:方法一、启动参数添加: -Xb

C/C++ chrono简单使用场景示例详解

《C/C++chrono简单使用场景示例详解》:本文主要介绍C/C++chrono简单使用场景示例详解,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友... 目录chrono使用场景举例1 输出格式化字符串chrono使用场景China编程举例1 输出格式化字符串示