I wanted to change it so that all my sprites are added in their own sub-methods, or in this case functions:Scene_Title.prototype.drawGameTitle = function() {
// Background
var bitmap = ImageManager.loadTitle1('TitleBG');
var bg = new Sprite(bitmap);
this._bg = bg;
this.addChild(bg);
...
// Title Name
var bitmap = ImageManager.loadTitle1('TitleName');
var titleName = new Sprite(bitmap);
this._titleName = titleName;
this._bg.addChild(titleName);
}
Appearently this._bg is undefined in the new function, so what am I doing wrong? Is it a simple Syntax error or have I missed something deeper? (I am most familiar with Ruby where this kind of thing should have worked)...
// Title Name
Scene_Title.prototype.drawName();
}
Scene_Title.prototype.drawName = function() {
var bitmap = ImageManager.loadTitle1('TitleName');
var titleName = new Sprite(bitmap);
this._titleName = titleName;
this._bg.addChild(titleName);
}