- Joined
- Feb 26, 2020
- Messages
- 62
- Reaction score
- 29
- First Language
- Chinese
- Primarily Uses
- RMMV
Hi, i created a simple function like this:
Then i tried to save it into Game's Save:
But, only the init property of the Game_Emap object had been saved, the function getRotation hadn't been saved at all. I can't figure why is that? Game_Map object still have its all function saved just fine?
Code:
function Game_Emap() {
this.initialize.apply(this, arguments);
}
Game_Emap.prototype.initialize = function() {
this._origin = 0.5;
this._hideEmap = false;
this._x = 0;
this._y = 0;
this._opacity = 255;
this._blendMode = 0;
this._updateDelay =1;
};
Game_Emap.prototype.update = function() {
};
Game_Emap.prototype.getRotation = function(event) {
var result = 0;
switch(event._direction) {
case 2:
result = 180; break;
case 4:
result = 270; break;
case 6:
result = 90; break;
case 8:
result = 0; break;
default:
result = 0;
}
return result;
};
Code:
var $gameEmap = null;
var old1 = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
old1.call(this);
$gameEmap = new Game_Emap();
};
var old2 = DataManager.makeSaveContents;
DataManager.makeSaveContents = function() {
var contents = old2.call(this);
contents.eMap = $gameEmap;
return contents;
};
var old3 = DataManager.extractSaveContents;
DataManager.extractSaveContents = function(contents) {
old3.call(this, contents);
$gameEmap = contents.eMap;
};
