And here we go again with something very primary! I have the following test code…
var config = {
width: 800,
height: 600,
type: Phaser.AUTO,
parent: 'test',
scene: {
create: create
}
};
var game = new Phaser.Game(config);
function create ()
{
showText();
}
function showText()
{
this.add.text(15, 15, 'test', { fontFamily: '"Arial"' });
}
Now debugger says “cannot read property ‘text’ of undefined” where it’s obvious to me that the issue is the scope (it doesn’t know what is ‘this’). I tried to replace ‘this’ with ‘window’ and ‘document’ but still no luck.
What the scope ‘this’ refers to here? And what would be the correct reference to use within functions?
Thanks!