Back when MV came out I was able to port my HUD from VX Ace without much issue, but even getting a box to appear while on the map scene seems impossible for me this time around. I've tried various ideas and setups with no luck, so I'm wondering if someone can make a simple starter plugin so I can see the method now for creating a constant window on screen.
Literally all I need to get going is a window that appears on the map screen and I can do the rest but I don't think I understand how to create one with the updated MZ code. Below is where I have been attempting to start remaking it, but I'm getting an error at this point when I try testing and I don't know where to go from here if I'm even on the right track.
Literally all I need to get going is a window that appears on the map screen and I can do the rest but I don't think I understand how to create one with the updated MZ code. Below is where I have been attempting to start remaking it, but I'm getting an error at this point when I try testing and I don't know where to go from here if I'm even on the right track.
Code:
function HUD_Window() {
this.initialize(...arguments);
}
HUD_Window.prototype = Object.create(Window_Base.prototype);
HUD_Window.prototype.constructor = HUD_Window;
HUD_Window.prototype.initialize = function(rect) {
Window_Base.prototype.initialize.call(this, rect);
this.opacity = 255;
this.contentsOpacity = 255;
this.refresh();
};
HUD_Window.prototype.refresh = function() {
this.contents.clear();
const width = Graphics.width
this.drawBackground(0, 0, width, this.lineHeight());
this.drawText("Testing?", 0, 0, width, "center");
};
HUD_Window.prototype.drawBackground = function(x, y, width, height) {
const color1 = ColorManager.dimColor1();
const color2 = ColorManager.dimColor2();
const half = width / 2;
this.contents.gradientFillRect(x, y, half, height, color2, color1);
this.contents.gradientFillRect(x + half, y, half, height, color1, color2);
};
//////////////////////////////////////////////////////////////////////////////////
const alias_createAllWindows = Scene_Map.prototype.createAllWindows
Scene_Map.prototype.createAllWindows = function() {
this.createHUD_Window();
};
Scene_Map.prototype.createHUD_Window = function() {
const rect = this.HUD_WindowRect();
this._HUD_Window = new HUD_Window(rect);
this.addWindow(this._HUD_Window);
};
Scene_Map.prototype.HUD_WindowRect = function() {
const wx = 200;
const wy = 200;
const ww = 300;
const wh = 300
return new Rectangle(wx, wy, ww, wh);
};