【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 -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 输出格式化字符串示

VS配置好Qt环境之后但无法打开ui界面的问题解决

《VS配置好Qt环境之后但无法打开ui界面的问题解决》本文主要介绍了VS配置好Qt环境之后但无法打开ui界面的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要... 目UKeLvb录找到Qt安装目录中designer.UKeLvBexe的路径找到vs中的解决方案资源

Java集成Onlyoffice的示例代码及场景分析

《Java集成Onlyoffice的示例代码及场景分析》:本文主要介绍Java集成Onlyoffice的示例代码及场景分析,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要... 需求场景:实现文档的在线编辑,团队协作总结:两个接口 + 前端页面 + 配置项接口1:一个接口,将o

Python Flask 库及应用场景

《PythonFlask库及应用场景》Flask是Python生态中​轻量级且高度灵活的Web开发框架,基于WerkzeugWSGI工具库和Jinja2模板引擎构建,下面给大家介绍PythonFl... 目录一、Flask 库简介二、核心组件与架构三、常用函数与核心操作 ​1. 基础应用搭建​2. 路由与参

IDEA实现回退提交的git代码(四种常见场景)

《IDEA实现回退提交的git代码(四种常见场景)》:本文主要介绍IDEA实现回退提交的git代码(四种常见场景),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1.已提交commit,还未push到远端(Undo Commit)2.已提交commit并push到

QT6中绘制UI的两种方法详解与示例代码

《QT6中绘制UI的两种方法详解与示例代码》Qt6提供了两种主要的UI绘制技术:​​QML(QtMeta-ObjectLanguage)​​和​​C++Widgets​​,这两种技术各有优势,适用于不... 目录一、QML 技术详解1.1 QML 简介1.2 QML 的核心概念1.3 QML 示例:简单按钮

在 PyQt 加载 UI 三种常见方法

《在PyQt加载UI三种常见方法》在PyQt中,加载UI文件通常指的是使用QtDesigner设计的.ui文件,并将其转换为Python代码,以便在PyQt应用程序中使用,这篇文章给大家介绍在... 目录方法一:使用 uic 模块动态加载 (不推荐用于大型项目)方法二:将 UI 文件编译为 python 模

Linux高并发场景下的网络参数调优实战指南

《Linux高并发场景下的网络参数调优实战指南》在高并发网络服务场景中,Linux内核的默认网络参数往往无法满足需求,导致性能瓶颈、连接超时甚至服务崩溃,本文基于真实案例分析,从参数解读、问题诊断到优... 目录一、问题背景:当并发连接遇上性能瓶颈1.1 案例环境1.2 初始参数分析二、深度诊断:连接状态与

Redis中RedisSearch使用及应用场景

《Redis中RedisSearch使用及应用场景》RedisSearch是一个强大的全文搜索和索引模块,可以为Redis添加高效的搜索功能,下面就来介绍一下RedisSearch使用及应用场景,感兴... 目录1. RedisSearch的基本概念2. RedisSearch的核心功能(1) 创建索引(2