- Joined
- Jan 26, 2014
- Messages
- 1,281
- Reaction score
- 106
- First Language
- Irish
- Primarily Uses
- N/A
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:
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?
// 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();};
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?
Last edited by a moderator:
