At the moment iam developing a Game in JavaScript.
I have the following Code which runs when an Object
($gameMap.events()[eventId])
is created:
var _GameEvent_initialize = Game_Event.prototype.initialize;
Game_Event.prototype.initialize = function(mapId, eventId) {
_GameEvent_initialize.call(this, mapId, eventId);
if (this.isEnemy()) {
this._eventEnemyId = this.isEnemy();
console.log(this._eventEnemyId);
this._eventEnemyHP = $dataEnemies[this._eventEnemyId].params[0];
console.log(this._eventEnemyHP);
this._eventEnemyATK = $dataEnemies[this._eventEnemyId].params[2]; // ATK
this._eventEnemyDEF = $dataEnemies[this._eventEnemyId].params[3]; // DEF
this._eventEnemyDEX = $dataEnemies[this._eventEnemyId].params[6]; // DEX
this._eventEnemyLCK = $dataEnemies[this._eventEnemyId].params[7]; // LCK
console.log("TRUMP!");
this._isEnemy = true;
}
this.test = "lel";
}
The console tells me, that it runs trough the IF. It looks like this:
1
50
TRUMP!
Also the object contains the variable "test" with the value "lel".
But the object doesn't contain _eventEnemyHP
etc.
So i can call $gameMap.events()[eventId].test;
but not $gameMap.events()[eventId]._eventEnemyHP;
What am I doing wrong?