Confira o Videos Épicos #45!
4 Respostas   129 Visualizações
0 Membros e 1 Visitante estão vendo este tópico.
//=============================================================================// 8dir_graphics.js//=============================================================================/*: * @plugindesc you can use 8 directions graphics * * @author Orcomarcio * * @help to use 8 direction graphics: 1 - insert "8dir" in the name of the file (wherever you want) 2 - put the 4 diagonal graphics right below the normal cross movement graphics, just as they where an another character 3 - be sure the diagonal movement graphics are facing directions in this order: South-West, NW, SE, NE 4 - choose either both top(normal) and bottom(diagonal) graphic sheet for the character, the code accounts for it 5 - if you want a cahracter to face a diagonal direction during, for example, a set-mouve-route, just call "this.setDirection(direction_id)" via script. if you want to know which id(number) stands for which direction just look at your numpad and imagine the character instead of the "5" key * * Free for commercial and non commercial use. */ ImageManager.is8DirCharacter = function(filename) { return filename.contains('8dir');};var alias_Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;Game_CharacterBase.prototype.initMembers = function() { alias_Game_CharacterBase_initMembers.call(this); //calls original method // added lines this._dir8 = this._direction; this._isDir8 = false; this._originalCharacterIndex;};var alias_CharacterBase_update = Game_CharacterBase.prototype.updateGame_CharacterBase.prototype.update = function() { alias_CharacterBase_update.call(this); //calls original method // added lines this.updateDir8();};Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) { this._tileId = 0; this._characterName = characterName; this._characterIndex = characterIndex; this._isObjectCharacter = ImageManager.isObjectCharacter(characterName); // added lines this._isDir8 = ImageManager.is8DirCharacter(characterName); this._originalCharacterIndex = (this._isDir8 && this._characterIndex > 3) ? this._characterIndex - 4 : this._characterIndex;};Game_CharacterBase.prototype.setDirection = function(d) { if (!this.isDirectionFixed() && d) { var dir4; switch (d) { case 1: dir4 = 2; break; case 3: dir4 = 6; break; case 7: dir4 = 4; break; case 9: dir4 = 8; break; default: dir4 = d; } this._direction = dir4; this._dir8 = d; } this.resetStopCount();};Game_CharacterBase.prototype.updateDir8 = function() { if (this._isDir8) { if (this._dir8 % 2 == 0) { // direzione a croce this._characterIndex = this._originalCharacterIndex; } else { // direzione in diagonale this._characterIndex = this._originalCharacterIndex + 4; } }};Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) { this.setMovementSuccess(this.canPassDiagonally(this._x, this._y, horz, vert)); if (this.isMovementSucceeded()) { this._x = $gameMap.roundXWithDirection(this._x, horz); this._y = $gameMap.roundYWithDirection(this._y, vert); this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(horz)); this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(vert)); this.increaseSteps(); } if (horz == 4) { if (vert == 2) this.setDirection(1); else this.setDirection(7); } else { if (vert == 2) this.setDirection(3); else this.setDirection(9); }};
OláTem esse plugin do Orcomarcio da RPG Maker Web:Código: [Selecionar]//=============================================================================// 8dir_graphics.js//=============================================================================/*: * @plugindesc you can use 8 directions graphics * * @author Orcomarcio * * @help to use 8 direction graphics: 1 - insert "8dir" in the name of the file (wherever you want) 2 - put the 4 diagonal graphics right below the normal cross movement graphics, just as they where an another character 3 - be sure the diagonal movement graphics are facing directions in this order: South-West, NW, SE, NE 4 - choose either both top(normal) and bottom(diagonal) graphic sheet for the character, the code accounts for it 5 - if you want a cahracter to face a diagonal direction during, for example, a set-mouve-route, just call "this.setDirection(direction_id)" via script. if you want to know which id(number) stands for which direction just look at your numpad and imagine the character instead of the "5" key * * Free for commercial and non commercial use. */ ImageManager.is8DirCharacter = function(filename) { return filename.contains('8dir');};var alias_Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;Game_CharacterBase.prototype.initMembers = function() { alias_Game_CharacterBase_initMembers.call(this); //calls original method // added lines this._dir8 = this._direction; this._isDir8 = false; this._originalCharacterIndex;};var alias_CharacterBase_update = Game_CharacterBase.prototype.updateGame_CharacterBase.prototype.update = function() { alias_CharacterBase_update.call(this); //calls original method // added lines this.updateDir8();};Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) { this._tileId = 0; this._characterName = characterName; this._characterIndex = characterIndex; this._isObjectCharacter = ImageManager.isObjectCharacter(characterName); // added lines this._isDir8 = ImageManager.is8DirCharacter(characterName); this._originalCharacterIndex = (this._isDir8 && this._characterIndex > 3) ? this._characterIndex - 4 : this._characterIndex;};Game_CharacterBase.prototype.setDirection = function(d) { if (!this.isDirectionFixed() && d) { var dir4; switch (d) { case 1: dir4 = 2; break; case 3: dir4 = 6; break; case 7: dir4 = 4; break; case 9: dir4 = 8; break; default: dir4 = d; } this._direction = dir4; this._dir8 = d; } this.resetStopCount();};Game_CharacterBase.prototype.updateDir8 = function() { if (this._isDir8) { if (this._dir8 % 2 == 0) { // direzione a croce this._characterIndex = this._originalCharacterIndex; } else { // direzione in diagonale this._characterIndex = this._originalCharacterIndex + 4; } }};Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) { this.setMovementSuccess(this.canPassDiagonally(this._x, this._y, horz, vert)); if (this.isMovementSucceeded()) { this._x = $gameMap.roundXWithDirection(this._x, horz); this._y = $gameMap.roundYWithDirection(this._y, vert); this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(horz)); this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(vert)); this.increaseSteps(); } if (horz == 4) { if (vert == 2) this.setDirection(1); else this.setDirection(7); } else { if (vert == 2) this.setDirection(3); else this.setDirection(9); }};Ele usa o Spritesheet padrão 4 x 3, sendo que os gráficos de diagonal ficam no Slot inferiorLembre de dar os devidos créditos!Link Original
Conseguiu fazer o que queria, TheHopelessBoy? Caso ainda persistam dúvidas, no cabeçalho do código há cinco pontos explicando como deve organizar o gráfico para que o código funcione. Se já estiver resolvido, favor marcar o tópico como resolvido para que possamos trancá-lo.