- Joined
- Sep 5, 2012
- Messages
- 187
- Reaction score
- 90
- First Language
- Indonesian
- Primarily Uses
- RMMV
Hi, guys
Today I tried to mess with Window Status. I tried to add a standing picture for each actor. I put it directly on refresh method (which was worked on RM VXAce). My problem is, it doesn't show any picture until I move to the next actor's status, and back.
When I tried to inspect it using ImageManager.isReady, it display false as if the picture hasn't been fully loaded. I feel that this is weird because actor's face, actor's character graphics, and other images are fully loaded. My workaround is just to add a callback function when the images has been fully loaded.
My question is:
Is there any "more direct" way to show picture (like RMVX Ace) rather than using callback (like this)? Or did I miss something like character images preload step?
I'm looking for any advice on this.
Today I tried to mess with Window Status. I tried to add a standing picture for each actor. I put it directly on refresh method (which was worked on RM VXAce). My problem is, it doesn't show any picture until I move to the next actor's status, and back.
When I tried to inspect it using ImageManager.isReady, it display false as if the picture hasn't been fully loaded. I feel that this is weird because actor's face, actor's character graphics, and other images are fully loaded. My workaround is just to add a callback function when the images has been fully loaded.
My question is:
Is there any "more direct" way to show picture (like RMVX Ace) rather than using callback (like this)? Or did I miss something like character images preload step?
I'm looking for any advice on this.
Code:
(function() {'use strict'// ==================================================================================// Game_Actor var _Game_Actor_initMembers = Game_Actor.prototype.initMembers; Game_Actor.prototype.initMembers = function() { _Game_Actor_initMembers.call(this); this._standingPicture = ''; }; var _Game_Actor_initImages = Game_Actor.prototype.initImages; Game_Actor.prototype.initImages = function() { _Game_Actor_initImages.call(this); var actor = this.actor(); this._standingPicture = actor.meta.standing_pic || ''; }; Game_Actor.prototype.pictureName = function(){ return this._standingPicture; };// ==================================================================================// Window_Status var _Window_Status_refresh = Window_Status.prototype.refresh; Window_Status.prototype.refresh = function() { _Window_Status_refresh.call(this); if (this._actor) { this.loadActorPicture(this._actor); } }; Window_Status.prototype.loadActorPicture = function(actor) { var filename = actor.pictureName(); if (filename == '') {return;} var bitmap = ImageManager.loadPicture(filename); bitmap.addLoadListener(function() { SceneManager._scene._statusWindow.drawActorPicture(bitmap); }); }; Window_Status.prototype.drawActorPicture = function(bitmap, x, y) { var pw = bitmap.width; var ph = bitmap.height; var ww = Graphics.boxWidth; var wh = Graphics.boxHeight; var x = x || ww - pw; var y = y || wh - ph; this.contents.blt(bitmap, 0, 0, pw, ph, x, y); };})(); // Don't touch this!
