【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

相关文章

防止Linux rm命令误操作的多场景防护方案与实践

《防止Linuxrm命令误操作的多场景防护方案与实践》在Linux系统中,rm命令是删除文件和目录的高效工具,但一旦误操作,如执行rm-rf/或rm-rf/*,极易导致系统数据灾难,本文针对不同场景... 目录引言理解 rm 命令及误操作风险rm 命令基础常见误操作案例防护方案使用 rm编程 别名及安全删除

Spring Security 前后端分离场景下的会话并发管理

《SpringSecurity前后端分离场景下的会话并发管理》本文介绍了在前后端分离架构下实现SpringSecurity会话并发管理的问题,传统Web开发中只需简单配置sessionManage... 目录背景分析传统 web 开发中的 sessionManagement 入口ConcurrentSess

99%的人都选错了! 路由器WiFi双频合一还是分开好的专业解析与适用场景探讨

《99%的人都选错了!路由器WiFi双频合一还是分开好的专业解析与适用场景探讨》关于双频路由器的“双频合一”与“分开使用”两种模式,用户往往存在诸多疑问,本文将从多个维度深入探讨这两种模式的优缺点,... 在如今“没有WiFi就等于与世隔绝”的时代,越来越多家庭、办公室都开始配置双频无线路由器。但你有没有注

深入解析Java NIO在高并发场景下的性能优化实践指南

《深入解析JavaNIO在高并发场景下的性能优化实践指南》随着互联网业务不断演进,对高并发、低延时网络服务的需求日益增长,本文将深入解析JavaNIO在高并发场景下的性能优化方法,希望对大家有所帮助... 目录简介一、技术背景与应用场景二、核心原理深入分析2.1 Selector多路复用2.2 Buffer

MySQL常用字符串函数示例和场景介绍

《MySQL常用字符串函数示例和场景介绍》MySQL提供了丰富的字符串函数帮助我们高效地对字符串进行处理、转换和分析,本文我将全面且深入地介绍MySQL常用的字符串函数,并结合具体示例和场景,帮你熟练... 目录一、字符串函数概述1.1 字符串函数的作用1.2 字符串函数分类二、字符串长度与统计函数2.1

Java Stream流之GroupBy的用法及应用场景

《JavaStream流之GroupBy的用法及应用场景》本教程将详细介绍如何在Java中使用Stream流的groupby方法,包括基本用法和一些常见的实际应用场景,感兴趣的朋友一起看看吧... 目录Java Stream流之GroupBy的用法1. 前言2. 基础概念什么是 GroupBy?Stream

java如何实现高并发场景下三级缓存的数据一致性

《java如何实现高并发场景下三级缓存的数据一致性》这篇文章主要为大家详细介绍了java如何实现高并发场景下三级缓存的数据一致性,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 下面代码是一个使用Java和Redisson实现的三级缓存服务,主要功能包括:1.缓存结构:本地缓存:使

C++中detach的作用、使用场景及注意事项

《C++中detach的作用、使用场景及注意事项》关于C++中的detach,它主要涉及多线程编程中的线程管理,理解detach的作用、使用场景以及注意事项,对于写出高效、安全的多线程程序至关重要,下... 目录一、什么是join()?它的作用是什么?类比一下:二、join()的作用总结三、join()怎么

在MySQL中实现冷热数据分离的方法及使用场景底层原理解析

《在MySQL中实现冷热数据分离的方法及使用场景底层原理解析》MySQL冷热数据分离通过分表/分区策略、数据归档和索引优化,将频繁访问的热数据与冷数据分开存储,提升查询效率并降低存储成本,适用于高并发... 目录实现冷热数据分离1. 分表策略2. 使用分区表3. 数据归档与迁移在mysql中实现冷热数据分

WinForm跨线程访问UI及UI卡死的解决方案

《WinForm跨线程访问UI及UI卡死的解决方案》在WinForm开发过程中,跨线程访问UI控件和界面卡死是常见的技术难题,由于Windows窗体应用程序的UI控件默认只能在主线程(UI线程)上操作... 目录前言正文案例1:直接线程操作(无UI访问)案例2:BeginInvoke访问UI(错误用法)案例