[Solved] Getting images to appear below windows

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
969
Reaction score
808
First Language
English
Primarily Uses
N/A
[Solved] Thanks for the pointers, Dreadshadow!


Hi there! I don't usually ask questions, but then again I don't usually work with too much with graphics, so...


I'm trying to figure out how to show Sprite images below windows in a scene.


Attached are the image and plugin file. Place the image in img/pictures/, and call the demo scene with


SceneManager.push(Scene_Demo);


... but I'm sure you already knew that.


Scroll down some more for the code.


Thanks in advance for your help!


Screenshot_1.png


function Scene_Demo() {
this.initialize.apply(this, arguments);
}

Scene_Demo.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Demo.prototype.constructor = Scene_Demo;

Scene_Demo.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
}

Scene_Demo.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);

this.createCommandWindow();

var img = ImageManager.loadBitmap("img/pictures/", "annoyance");
this._image = new Sprite(img);
this._image.x = 400;
this._image.y = 300;
this.addChild(this._image);
}

Scene_Demo.prototype.createCommandWindow = function() {
this._choiceWindow = new Window_ChooseOne(0, 0);
this._choiceWindow.x = (Graphics.width - this._choiceWindow.width) / 2;
this._choiceWindow.y = (Graphics.height - this._choiceWindow.height) / 2;
this._choiceWindow.setHandler('yes', this.yesCommand.bind(this));
this._choiceWindow.setHandler('no', this.cancelCommand.bind(this));
this._choiceWindow.setHandler('cancel', this.cancelCommand.bind(this));
this.addWindow(this._choiceWindow);
}

Scene_Demo.prototype.yesCommand = function () {}

Scene_Demo.prototype.cancelCommand = function () {
this.popScene();
}


function Window_ChooseOne() {
this.initialize.apply(this, arguments);
}

Window_ChooseOne.prototype = Object.create(Window_Command.prototype);
Window_ChooseOne.prototype.constructor = Window_ChooseOne;

Window_ChooseOne.prototype.makeCommandList = function () {
this.addCommand("yes", 'yes');
this.addCommand("no", 'no');
};




Attachments


View attachment Demo.js


annoyance.png
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
At first glance, I see nowhere any method that sets or override layers. I didn't had the time to check MV scripts and how they work, I will actually check to find any potential methods that you might need to override.I will dump in the spoiler some places that might intererst you. I suggest you open the scripts on notepad++ and take a look.

NOTICE:  I AM NOT SURE THIS CAN HELP YOU, I JUST PINPOINT THAT THERE MIGHT BE SOME METHODS YOU MIGHT ALSO NEED TO OVERRIDE:


rpg_scenes line 57


Scene_Base.prototype.createWindowLayer = function() {
    var width = Graphics.boxWidth;
    var height = Graphics.boxHeight;
    var x = (Graphics.width - width) / 2;
    var y = (Graphics.height - height) / 2;
    this._windowLayer = new WindowLayer();
    this._windowLayer.move(x, y, width, height);
    this.addChild(this._windowLayer);
};


On rpg_windows you should probably check padding


Check also  rpg_core check also lines


6433


6479


6514


6526


6539


6594


6607


6651
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
969
Reaction score
808
First Language
English
Primarily Uses
N/A
Ah-- I found the solution. It is indeed as you say.


You need to change "when" the window layer is created:


(code tags don't support bolding so I'll leave it as text)


Scene_Demo.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    
    // this.createCommandWindow(); we move this down to "after" the image is added


    var img = ImageManager.loadBitmap("img/pictures/", "annoyance");
    this._image = new Sprite(img);
    this._image.x = 400;
    this._image.y = 300;
    this.addChild(this._image);


    this.createWindowLayer();


    this.createCommandWindow();
}
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,470
Members
137,821
Latest member
Capterson
Top