Hi, newbie here. Can I ask you guys something?

Hi, I'm new in this forum. My English is not very good. So I'm sorry if maybe I have violate any forum rules without my acknowledgement. This is my first time in this forum.
I actually been using RPG Maker since a long time (VX and VX Ace), but MV was very new to me. I want to learn javascript, but so far I dn't gain any significant improvement. That being said, I have a problem about javascript.
I want to show an image but the problem is I don't know how to set their size to fit the screen. I tried writing these:
createLayout = function() {
var ayy = ImageManager.ambil_gambar("Layout");
this._layout = new Sprite(ayy);
this._layout.width = Graphics.boxWidth;
this._layout.height = Graphics.boxHeight;
this._field.addChild(this._layout);
};
But after I tested it, the image size still doesn't change. Can anyone help me what should I write to make it work?
Also, I am fuly aware this place is not for asking this kind of stuff, but my post hasn't been approved for long time, so maybe if that post finally been approved then I will edit this post as just an introduction post. Sorry I'm very new at javascript and yes I haven't read all the RPG Maker MV core plugins. Maybe any suggestion on how to read RPG Maker MV core plugins easier or maybe a direction on where should I find any good RPG Maker MV/MZ core plugins documentation? Many thanks for your time and attention.
Hi, I'm new in this forum. My English is not very good. So I'm sorry if maybe I have violate any forum rules without my acknowledgement. This is my first time in this forum.
I actually been using RPG Maker since a long time (VX and VX Ace), but MV was very new to me. I want to learn javascript, but so far I dn't gain any significant improvement. That being said, I have a problem about javascript.
I want to show an image but the problem is I don't know how to set their size to fit the screen. I tried writing these:
createLayout = function() {
var ayy = ImageManager.ambil_gambar("Layout");
this._layout = new Sprite(ayy);
this._layout.width = Graphics.boxWidth;
this._layout.height = Graphics.boxHeight;
this._field.addChild(this._layout);
};
But after I tested it, the image size still doesn't change. Can anyone help me what should I write to make it work?
Also, I am fuly aware this place is not for asking this kind of stuff, but my post hasn't been approved for long time, so maybe if that post finally been approved then I will edit this post as just an introduction post. Sorry I'm very new at javascript and yes I haven't read all the RPG Maker MV core plugins. Maybe any suggestion on how to read RPG Maker MV core plugins easier or maybe a direction on where should I find any good RPG Maker MV/MZ core plugins documentation? Many thanks for your time and attention.
You're modifying the wrong part.
Width and Height are the width and height of the bitmap you're loading, and you shouldn't change them, since they allow you to know the dimensions of the image (and use that in calculations) but they do not actually affect anything.

The image will always be exactly the size of the image you're loading, so the best way is to make sure that the image has the right size in Photoshop.
If you want to do it via calculation, you need to change the scale (stretching the image in the x and y dimension).

E.g.
JavaScript:
this._layout.scale.x= 1.5;
=> The image will be 150% as wide as before.

If you want to calculate the scale factor to match your resolution, you're actually going to have to do a bit more math.
In slow:
JavaScript:
const screenSizeX = Graphics.boxWidth; // width of screen
const imageWidth = this._layout.width; // width of image
const scaleModX = screenSizeX / imageWidth; // how often the image fits into the screen
this._layout.scale.x = scaleModX; // => has the x value multiplied by how often the image fits into the screen

Single Line for x and y:
JavaScript:
this._layout.scale.x = Graphics.boxWidth / this._layout.width;
this._layout.scale.y= Graphics.boxHeight / this._layout.height;

An easier way to dive into the RPGMZ files is to look at them as split files, instead of big files:
Check out the Split Classes:

Ultimately, you should focus on learning Javascript before learning how RPGMZ works, since it can otherwise be hard to read. There is no such thing unfortunately as a thorough documentation for beginners. The only way to really "learn" how RPGMZ works is to understand javascript already.

Original thread: https://forums.rpgmakerweb.com/threads/hi-newbie-here-can-i-ask-you-guys-something.145251/