I have created sprites in the Map Scene to display armor and weapons on my character. Right now I have 3 separate sprites that move with the character. I cannot control which one sits on top or in between the others. How can I do this?
Scene_Map.prototype.initialize = function() { Scene_Base.prototype.initialize.call(this); this._waitCount = 0; this._encounterEffectDuration = 0; this._mapLoaded = false; this._touchCount = 0; this._bitmapWeapon; this._spriteWeapon; this._currentWeaponID; this._bitmapShield; this._spriteShield; this._currentShieldID; this._bitmapChest; this._spriteChest; this._currentChestID;};Scene_Map.prototype.loadEquipment = function() { this.loadWeapon(); this.loadShield(); this.loadChest();};Scene_Map.prototype.loadWeapon = function() { if ($gameActors.actor(1).equips()[0]) { this._currentWeaponID = $gameActors.actor(1).equips()[0].id; var filename = $gameActors.actor(1).equips()[0].meta.image; var bitmap = ImageManager.loadCharacter(filename); this._bitmapWeapon = bitmap; var sprite = new Sprite(bitmap); this._spriteWeapon = sprite; this._spriteWeapon.opacity = 0; this.addChild(this._spriteWeapon); } else { this.removeChild(this._spriteWeapon); }};Scene_Map.prototype.setWeaponFrame = function() { if ($gameActors.actor(1).equips()[0]) { if (this._currentWeaponID === $gameActors.actor(1).equips()[0].id) { var pw = this._bitmapWeapon.width / 32; var ph = this._bitmapWeapon.height / 8; var sx = (playerBlockX + $gamePlayer.pattern()) * pw; var sy = playerPatternY * ph; this._spriteWeapon.x = $gamePlayer.screenX() - 65; this._spriteWeapon.y = $gamePlayer.screenY() - 127; this._spriteWeapon.opacity = 255; this._spriteWeapon.setFrame(sx, sy, pw, ph); } else { this.removeChild(this._spriteWeapon); this.loadWeapon(); }; } else { this.loadWeapon(); }; };Scene_Map.prototype.loadShield = function() { if ($gameActors.actor(1).equips()[1]) { this._currentShieldID = $gameActors.actor(1).equips()[1].id; var filename = $gameActors.actor(1).equips()[1].meta.image; var bitmap = ImageManager.loadCharacter(filename); this._bitmapShield = bitmap; var sprite = new Sprite(bitmap); this._bitmapShield.z = 2; this._spriteShield = sprite; this._spriteShield.opacity = 0; this.addChildAt(this._spriteShield, 3); } else { this.removeChild(this._spriteShield); }};Scene_Map.prototype.setShieldFrame = function() { if ($gameActors.actor(1).equips()[1]) { if (this._currentShieldID === $gameActors.actor(1).equips()[1].id) { var pw = this._bitmapShield.width / 32; var ph = this._bitmapShield.height / 8; var sx = (playerBlockX + $gamePlayer.pattern()) * pw; var sy = playerPatternY * ph; this._spriteShield.x = $gamePlayer.screenX() - 65; this._spriteShield.y = $gamePlayer.screenY() - 127; this._spriteShield.opacity = 255; this._spriteShield.setFrame(sx, sy, pw, ph); } else { this.removeChild(this._spriteShield); this.loadShield(); }; } else { this.loadShield(); }; };Scene_Map.prototype.loadChest = function() { if ($gameActors.actor(1).equips()[3]) { this._currentChestID = $gameActors.actor(1).equips()[3].id; var filename = $gameActors.actor(1).equips()[3].meta.image; var bitmap = ImageManager.loadCharacter(filename); this._bitmapChest = bitmap; var sprite = new Sprite(bitmap); this._spriteChest = sprite; this._spriteChest.opacity = 0; this.addChild(this._spriteChest); } else { this.removeChild(this._spriteChest); }};Scene_Map.prototype.setChestFrame = function() { if ($gameActors.actor(1).equips()[3]) { if (this._currentChestID === $gameActors.actor(1).equips()[3].id) { var pw = this._bitmapChest.width / 32; var ph = this._bitmapChest.height / 8; var sx = (playerBlockX + $gamePlayer.pattern()) * pw; var sy = playerPatternY * ph; this._spriteChest.x = $gamePlayer.screenX() - 65; this._spriteChest.y = $gamePlayer.screenY() - 127; this._spriteChest.opacity = 255; this._spriteChest.setFrame(sx, sy, pw, ph); } else { this.removeChild(this._spriteChest); this.loadChest(); }; } else { this.loadChest(); }; };Scene_Map.prototype.onMapLoaded = function() { if (this._transfer) { $gamePlayer.performTransfer(); } this.createDisplayObjects(); this.loadEquipment();};Scene_Map.prototype.update = function() { this.setWeaponFrame(); this.setShieldFrame(); this.setChestFrame(); this.updateDestination(); this.updateMainMultiply(); if (this.isSceneChangeOk()) { this.updateScene(); } else if (SceneManager.isNextScene(Scene_Battle)) { this.updateEncounterEffect(); } this.updateWaitCount(); Scene_Base.prototype.update.call(this);};Arranging the loading order kind of works with the player sprite but all of the equipment sprites appear on top of events even if the event is set to 'above player'.
Scene_Map.prototype.initialize = function() { Scene_Base.prototype.initialize.call(this); this._waitCount = 0; this._encounterEffectDuration = 0; this._mapLoaded = false; this._touchCount = 0; this._bitmapWeapon; this._spriteWeapon; this._currentWeaponID; this._bitmapShield; this._spriteShield; this._currentShieldID; this._bitmapChest; this._spriteChest; this._currentChestID;};Scene_Map.prototype.loadEquipment = function() { this.loadWeapon(); this.loadShield(); this.loadChest();};Scene_Map.prototype.loadWeapon = function() { if ($gameActors.actor(1).equips()[0]) { this._currentWeaponID = $gameActors.actor(1).equips()[0].id; var filename = $gameActors.actor(1).equips()[0].meta.image; var bitmap = ImageManager.loadCharacter(filename); this._bitmapWeapon = bitmap; var sprite = new Sprite(bitmap); this._spriteWeapon = sprite; this._spriteWeapon.opacity = 0; this.addChild(this._spriteWeapon); } else { this.removeChild(this._spriteWeapon); }};Scene_Map.prototype.setWeaponFrame = function() { if ($gameActors.actor(1).equips()[0]) { if (this._currentWeaponID === $gameActors.actor(1).equips()[0].id) { var pw = this._bitmapWeapon.width / 32; var ph = this._bitmapWeapon.height / 8; var sx = (playerBlockX + $gamePlayer.pattern()) * pw; var sy = playerPatternY * ph; this._spriteWeapon.x = $gamePlayer.screenX() - 65; this._spriteWeapon.y = $gamePlayer.screenY() - 127; this._spriteWeapon.opacity = 255; this._spriteWeapon.setFrame(sx, sy, pw, ph); } else { this.removeChild(this._spriteWeapon); this.loadWeapon(); }; } else { this.loadWeapon(); }; };Scene_Map.prototype.loadShield = function() { if ($gameActors.actor(1).equips()[1]) { this._currentShieldID = $gameActors.actor(1).equips()[1].id; var filename = $gameActors.actor(1).equips()[1].meta.image; var bitmap = ImageManager.loadCharacter(filename); this._bitmapShield = bitmap; var sprite = new Sprite(bitmap); this._bitmapShield.z = 2; this._spriteShield = sprite; this._spriteShield.opacity = 0; this.addChildAt(this._spriteShield, 3); } else { this.removeChild(this._spriteShield); }};Scene_Map.prototype.setShieldFrame = function() { if ($gameActors.actor(1).equips()[1]) { if (this._currentShieldID === $gameActors.actor(1).equips()[1].id) { var pw = this._bitmapShield.width / 32; var ph = this._bitmapShield.height / 8; var sx = (playerBlockX + $gamePlayer.pattern()) * pw; var sy = playerPatternY * ph; this._spriteShield.x = $gamePlayer.screenX() - 65; this._spriteShield.y = $gamePlayer.screenY() - 127; this._spriteShield.opacity = 255; this._spriteShield.setFrame(sx, sy, pw, ph); } else { this.removeChild(this._spriteShield); this.loadShield(); }; } else { this.loadShield(); }; };Scene_Map.prototype.loadChest = function() { if ($gameActors.actor(1).equips()[3]) { this._currentChestID = $gameActors.actor(1).equips()[3].id; var filename = $gameActors.actor(1).equips()[3].meta.image; var bitmap = ImageManager.loadCharacter(filename); this._bitmapChest = bitmap; var sprite = new Sprite(bitmap); this._spriteChest = sprite; this._spriteChest.opacity = 0; this.addChild(this._spriteChest); } else { this.removeChild(this._spriteChest); }};Scene_Map.prototype.setChestFrame = function() { if ($gameActors.actor(1).equips()[3]) { if (this._currentChestID === $gameActors.actor(1).equips()[3].id) { var pw = this._bitmapChest.width / 32; var ph = this._bitmapChest.height / 8; var sx = (playerBlockX + $gamePlayer.pattern()) * pw; var sy = playerPatternY * ph; this._spriteChest.x = $gamePlayer.screenX() - 65; this._spriteChest.y = $gamePlayer.screenY() - 127; this._spriteChest.opacity = 255; this._spriteChest.setFrame(sx, sy, pw, ph); } else { this.removeChild(this._spriteChest); this.loadChest(); }; } else { this.loadChest(); }; };Scene_Map.prototype.onMapLoaded = function() { if (this._transfer) { $gamePlayer.performTransfer(); } this.createDisplayObjects(); this.loadEquipment();};Scene_Map.prototype.update = function() { this.setWeaponFrame(); this.setShieldFrame(); this.setChestFrame(); this.updateDestination(); this.updateMainMultiply(); if (this.isSceneChangeOk()) { this.updateScene(); } else if (SceneManager.isNextScene(Scene_Battle)) { this.updateEncounterEffect(); } this.updateWaitCount(); Scene_Base.prototype.update.call(this);};Arranging the loading order kind of works with the player sprite but all of the equipment sprites appear on top of events even if the event is set to 'above player'.