Properly defined but not showing itself

I have made this sample code in Spriteset_Map and Game_System, where I wanted to place a sample image on the screen that the character can step unto:

Spoiler
// Ground OverlaySpriteset_Map.prototype.ground_overlay;Game_System.prototype.ground_overlay_name = null;Game_System.prototype.ground_overlay_opacity = 0;Game_System.prototype.ground_overlay_x = 0;Game_System.prototype.ground_overlay_y = 0;ImageManager.loadOverlay = function(filename, hue) { return this.loadBitmap('img/overlays/', filename, hue, false);}Spriteset_Map.prototype.initialize = function() { Spriteset_Base.prototype.initialize.call(this); this.ground_overlay = null; $gameSystem.ground_overlay_name = null; $gameSystem.ground_overlay_opacity = 255; $gameSystem.ground_overlay_x = 0; $gameSystem.ground_overlay_y = 0; };Spriteset_Map.prototype.createGroundOverlay = function() { this.ground_overlay = new Sprite(); this.ground_overlay.bitmap = ImageManager.loadOverlay($gameSystem.ground_overlay_name); this.ground_overlay.opacity = $gameSystem.ground_overlay_opacity; this.ground_overlay.z = 10; this._tilemap.addChild(this.ground_overlay); console.log(this.ground_overlay); };Game_System.prototype.call_ground_overlay = function(ground_overlay_name, ground_overlay_opacity, x, y) { this.ground_overlay_name = ground_overlay_name; this.ground_overlay_opacity = ground_overlay_opacity; this.ground_overlay_x = x; this.ground_overlay_y = y;}Spriteset_Map.prototype.updateGroundOverlay = function() { this.ground_overlay.x = this.ground_overlay_x; this.ground_overlay.y = this.ground_overlay_y; }Spriteset_Map.prototype.createLowerLayer = function() { Spriteset_Base.prototype.createLowerLayer.call(this); this.createParallax(); this.createTilemap(); // create ground layer this.createGroundOverlay(); this.createCharacters(); this.createShadow(); this.createDestination(); this.createWeather();};Spriteset_Map.prototype.update = function() { Spriteset_Base.prototype.update.call(this); this.updateTileset(); this.updateParallax(); this.updateGroundOverlay(); this.updateTilemap(); this.updateShadow(); this.updateWeather();}; 
It keeps saying everything about the functions I made is undefined, such as the x property being null, but they are referenced in Game_System, yet I am sure I have declared them quite well, or did I miss something? Also, I notice that when I add something into the spriteset map, it doesn't update right away, you'd have to go to the menu then go back to the map so everything inside the map would be updated. Is there a workaround on this?

the script command I suppose to want to use is:

$gameSystem.call_ground_overlay('Brick', 255, 0, 0);so the ground layer appears but it doesn't because of the error I am getting. Anything wrong with my code?
can you show the error code ? 

it's better to know wich lines are getting the error
It's on this part:

Code:
Spriteset_Map.prototype.updateGroundOverlay = function() {    this.ground_overlay.x = this.ground_overlay_x;  this.ground_overlay.y = this.ground_overlay_y;  }
Well looking at your code I can't find the properties "ground_overlay_x" or "ground_overlay_y" in your Spriteset_Map, so I'm assuming it's suppose to be $gameSystem not this.
Tried to change it to gameSystem and the error is gone, but this time it says there's an error on the eval.
hum sprite manipulation can be tricky to do

if I understand you try to do a sprite who overlay on the maps...likes fogs or ect?  or you try to do parrallaxed mappings ? 

I am just asking for be sure of what you want to do

but sometime it's better to do a external function who will handle's this so it's will avoid any kind of issue's like this 
Sorry to hyjack your thread a bit, but I've just done some basic JS through codeacademy so I can surely read all the code, just some parts are escaping me atm.

Like its been said already, I can see that you wan't to use the same properties for both Spriteset_Map and Game_System, with them having any connection/inheritance, that surely can't work.

But what I can't understand either is JS version of 'initialize'.

Does it call itself? If not, when does it happen, I can't seem to find anything about that.
When you create something you call the initialize function. The update function will run automatically every frame. So if you don't call the initialize then it won't run that function.
Hi everyone, the problem was solved, thanks a lot.

Original thread: https://forums.rpgmakerweb.com/threads/properly-defined-but-not-showing-itself.50516/