Project1
标题:
大佬能不能帮看一下这段代码,帮改成正确的格式
[打印本页]
作者:
雷影
时间:
2023-9-24 20:49
标题:
大佬能不能帮看一下这段代码,帮改成正确的格式
本帖最后由 雷影 于 2023-9-24 20:50 编辑
代码本身是想学习时找到的别人教学时的教程内容,然后教学没有后续内容了。自己拿来用一下,无奈苦手!
具体就是想在菜单画面时,显示一个窗口,显示当前游戏进度的基本内容任务。
剧情进度值用个变量来记录,当到一定值时显示不同任务内容,因为是解密游戏,所以只设定一个主线进度。
想要帮看的代码是第39行“窗口显示的内容”部分,
如何正确获取指定ID变量的值,然后依照变量值显示不同内容(自己写的显然是错了)
//-------------------------------------------------------------------------
//************
//创建一个独立窗口显示内容
//************
var _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
_Scene_Menu_create.call(this);
//创建自定义窗口,并将它加入主菜单界面
this._tipsWindow = new Window_Tips(0, 0);
this._tipsWindow.y = this._commandWindow.y + this._commandWindow.height + 50;
//设置自定义窗口的Y坐标,由左上部的菜单命令窗口的Y轴坐标及其高度来决定
this.addWindow(this._tipsWindow);
};
function Window_Tips() {
this.initialize.apply(this, arguments);
}
Window_Tips.prototype = Object.create(Window_Base.prototype);
Window_Tips.prototype.constructor = Window_Tips;
Window_Tips.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Base.prototype.initialize.call(this, x+200, y, width, height);
this.refresh();
};
Window_Tips.prototype.windowWidth = function() {
return 440; //自定义窗口的宽度
};
Window_Tips.prototype.windowHeight = function() {
return this.fittingHeight(3); //自定义窗口的高度:通过设定窗口要容纳的行数来自动计算高度
};
//窗口显示的内容
Window_Tips.prototype.refresh = function(actor) {
this.contents.clear();
var V = get.$gameVariables[100];//取得100号变量的值
if(v==1){
this.drawTextEx("剧情进度变量值为1时显示的内容", 0, 0);
} else if (v == 2) {
this.drawTextEx("剧情进度变量值为2时显示的内容", 0, 0);
} else if (v == 3) {
this.drawTextEx("剧情进度变量值为3时显示的内容", 0, 0);
}
};
Window_Tips.prototype.open = function() {
this.refresh();
Window_Base.prototype.open.call(this);
};
复制代码
作者:
HM495
时间:
2023-9-24 21:12
$gameVariables.value(100)
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1