MV Window_Selectable

Started by Kiwa, December 18, 2015, 04:14:14 am

Previous topic - Next topic

Kiwa

Hey fellas.

I'm still working on understanding RMMV and how it works.

I want to make more custom windows but this time I want to control the selecting.

My goal is to make my current script into an icon only script. Why? well...for practice and maybe it will work well for an android game.

I've managed to expand the size of an icon. not stretch it but expand the pixels from 32 to 64.
of coarse it now shows 4 icons but that's ok. I'll Fix it later.

the selectable box behind it is still regular size. I changed some code around and got the cursor rect to get bigger but i cant click it still. i need to click where the original row was.

I found another method which allowed me to do as I wanted but all text was screwed up.


Here's a failed image of my attempt. Any Ideas?

Spoiler: ShowHide



Soul

The cursor is drawn in each of the windows differently depending on the item being selected. You can isolate a function that resembles the original but adjust the rectangle value.

Check this part:


Window_Selectable.prototype.itemRect = function(index) {
    var rect = new Rectangle();
    var maxCols = this.maxCols();
    rect.width = this.itemWidth();
    rect.height = this.itemHeight();
    rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX;
    rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY;
    return rect;
};


look at how rect.width is being drawn. It is drawn based on the width of the item it is being selected at.
This author is known to plagiarize other users' scripts. Do not use any scripts posted by this user.

Kiwa

Thanks for the reply Soul!

Btw. I really like your scripts and your youtube stuff. I'm gonna have to watch all the videos from the start.
Thanks for taking the time to look into this.

I found that method before and tried changing some things. I got the rect to change but if i click on the rect it wont select.
I found it's due to the Window_Base.lineHeight

If I increase the line height from 36 to 72 it fFITS, IT works!!! But ALL text is now screwed up and has MASSIVE gaps lol.

I was thinking about using a conditional to set the line height in Window_Base.lineHeight. but I think there has to be a better way with OOP.

Window_Selectable comes from Window_Base which comes from Window...I believe.
So if this inherits from Window_Base where the 'lineHeight' method is build. can't I use "this.lineHeight = 72;" inside of createSkillWindow.
it doesn't give me bugs but it has no affect.

I'm inexperienced with programming so I may just have a misunderstanding of how/if functions inherit or only objects. (i still have trouble telling those apart too lol)

I have to crash since I have to work in a few more hours. But I'm itching to get this programming stuff down.

Thanks Soul

:D