- Joined
- Dec 9, 2015
- Messages
- 109
- Reaction score
- 10
- First Language
- en-
- Primarily Uses
- N/A
Ok ive been stuck for a while now and ive just now thought of a solution. Naturaly since my code doesnt work as intended the problem must be on my side hence why im here. I need your collective help to recreate a small section of the code.
It should be simple enough. A window with 3 selectable panels much like on the default save file screen however in a horizontal manner, and now for the important part; in any one of those panels 'draw' a character. (using drawCharacter from window base i presume.)
Simple right?
Anyway, by comparing i'll be able to see if and where there are errors in my script.
thanks you for your help and patience.
--------------------------------------------------------------------------------------------
ok the thing is, drawcharacter doesn't seem to work, but if i go back a scene then return it works, but never on the first time.
attached is my code its terrible and probably unreadable tho, sorry....
It should be simple enough. A window with 3 selectable panels much like on the default save file screen however in a horizontal manner, and now for the important part; in any one of those panels 'draw' a character. (using drawCharacter from window base i presume.)
Simple right?
Anyway, by comparing i'll be able to see if and where there are errors in my script.
thanks you for your help and patience.
--------------------------------------------------------------------------------------------
ok the thing is, drawcharacter doesn't seem to work, but if i go back a scene then return it works, but never on the first time.
attached is my code its terrible and probably unreadable tho, sorry....
Code:
//-----------------------------------------------------------------------------
// Window_SavefileList
//
// The window for selecting a save file on the save and load screens.
function Window_SavefileList() {
this.initialize.apply(this, arguments);
}
Window_SavefileList.prototype = Object.create(Window_Selectable.prototype);
Window_SavefileList.prototype.constructor = Window_SavefileList;
Window_SavefileList.prototype.initialize = function(x, y, width, height) {
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this.activate();
this.y += 75;
this.width = Graphics.boxWidth - 70;
this.height = Graphics.boxHeight / 4 + 190;
this._mode = null;
this.setBackgroundType(2);
};
Window_SavefileList.prototype.setMode = function(mode) {
this._mode = mode;
};
Window_SavefileList.prototype.maxCols = function() {
return 3;
};
Window_SavefileList.prototype.maxItems = function() {
return 3; //DataManager.maxSavefiles();
};
Window_SavefileList.prototype.maxVisibleItems = function() {
return 3; //_max_save_slots; //5;
};
Window_SavefileList.prototype.itemHeight = function() {
var innerHeight = this.height - this.padding * 2;
return Graphics.boxHeight / 4 + 150;//Math.floor(innerHeight / this.maxVisibleItems());
};
Window_SavefileList.prototype.drawItem = function(index) {
var id = index + 1;
var valid = DataManager.isThisGameFile(id);
var info = DataManager.loadSavefileInfo(id);
locationname[id] = DataManager.loadSavefileInfo(id).location;
var rect = this.itemRectForText(index);
this.resetTextColor();
if (this._mode === 'load') {
this.changePaintOpacity(valid);
}
this.drawFileId(id, rect.x, rect.y);
if (info) {
//console.log("checked out fine!");
this.changePaintOpacity(valid);
this.drawContents(info, rect, valid);
this.changePaintOpacity(true);
}
};
Window_SavefileList.prototype.update = function()
{
Window_Selectable.prototype.update.call(this);
//----------------------
this._touching = false;
var ind1 = this.index();
var is1_enabled = false;
var is2_enabled = false;
var is3_enabled = false;
var curr;
var checked_;
catch_ind = ind1;
/*
if (ind1 == 0)
{
is1_enabled = true;
is2_enabled = false;
is3_enabled = false;
};
if (ind1 == 1)
{
is1_enabled = false;
is2_enabled = true;
is3_enabled = false;
};
if (ind1 == 2)
{
is1_enabled = false;
is2_enabled = false;
is3_enabled = true;
};
if(is1_enabled == true)
{
curr = 1;
} else if (is2_enabled == true)
{
curr = 2;
} else if (is3_enabled == true)
{
curr = 3;
}*/
if(Input.isTriggered('right') || Input.isTriggered('left') || Input.isTriggered('up') || Input.isTriggered('down'))
{
console.log(locationname[catch_ind + 1]);
}
//-----------------------
};
Window_SavefileList.prototype.drawFileId = function(id, x, y) {
//this.drawText(TextManager.file + ' ' + id, x, y, 180);
};
Window_SavefileList.prototype.drawContents = function(info, rect, valid) {
var bottom = rect.y + rect.height;
if (rect.width >= 20) {
//this.drawGameTitle(info, ++ rect.x, rect.y, rect.width/2 + rect.width/4);
if (valid) {
this.drawPartyCharacters(info, rect.x, rect.y + 20);
//console.log("bottom = ", bottom, "info = ", info, "rect x = ", rect.x , "rect.y = ", rect.y, "rect.width = ", rect.width );
}
}
var lineHeight = this.lineHeight();
var y2 = bottom - lineHeight;
if (y2 >= lineHeight) {
// this.drawPlaytime(info, rect.x, y2, rect.width);
}
};
Window_SavefileList.prototype.drawGameTitle = function(info, x, y, width) {
if (info.title) {
this.drawText(info.title, x, y, width);
}
};
Window_SavefileList.prototype.drawPartyCharacters = function(info, x, y) {
if (info.characters) {
for (var i = 0; i < info.characters.length; i++) {
console.log(info.characters[i]);
var data = info.characters[i];
this.drawCharacter("Actor1", 7, x + 10, y + 10); // + i * 48 problem is here!!!!! <<<<<+======= i think
//sprite.anchor.x = 0.5;
// sprite.anchor.y = 0.5;
}
}
};
Window_SavefileList.prototype.drawPlaytime = function(info, x, y, width) {
if (info.playtime) {
this.drawText(info.playtime, x, y, width, 'right');
}
};
Window_SavefileList.prototype.playOkSound = function() {
};
Window_SavefileList.prototype._refreshCursor = function() {
var pad = this._padding;
var x = 0; //this._cursorRect.x + pad - this.origin.x;
var y = 0; //this._cursorRect.y + pad - this.origin.y;
var w = 0; //this._cursorRect.width;
var h = 0; //this._cursorRect.height;
var m = 0; //4;
var x2 = 0; //Math.max(x + 25, pad);
var y2 = 0; //Math.max(y - 7, pad);
var ox = 0; //x - x2;
var oy = 0; //y - y2;
var w2 = 0; //Math.min(w, this._width - pad - x2);
var h2 = 0; //Math.min(h, this._height - pad - y2);
var bitmap = null; //ImageManager.loadTitle2("bar3");
this._windowCursorSprite.bitmap = null;// bitmap;
this._windowCursorSprite.move(x2, y2);
};
Last edited:

