This.add.circle beginner question

Hello,

I’m new here, hi everyone :blush:

Anyway, I’m new to both Phaser and Javascript having previously been a Java developer, but I’m really stuck with this noob question and hoping someone can help :slight_smile:

I’m often seeing in beginner examples lines similar to this -

this.add.text(…) and this.add.circle(…)

But what is going on with this.add? I understand that ‘this’ is the Phaser Game object, but what is ‘add’? Is it a function or a member variable or from a prototype or is it some inbuilt javascript function?

I have looked and looked though the API documentation and can’t see add() anywhere - could someone give me a hint?

I know this is a super beginner question, many thanks for any help at all as it’s driving me nuts :slight_smile:

cheers

this is the scene and this.add is an instance of GameObjectFactory. (See Members in Scenes or API Chains in Phaser Help Center.)

1 Like

That’s just what I needed, many thanks!!