Jump to content

game instance vs data object method


douglas
 Share

Recommended Posts

I don't understand why i can't use the game instance instead of Phaser.Math.PI2 in this scratch code

https://jsfiddle.net/johndo101/cfx0zxo3/

Here you can find a pointer i use to understand javascript :

Link to comment
Share on other sites

`game` is an instance of Phaser.Game, not an instance of Phaser, although its unlikely that a constructor would copy over dynamic members from Phaser even if it was. Hence Math is not defined and you're trying to access a member of an undefined variable and therefore explosion.

Re-read those links you posted, particularly in reference to adding members to a prototype.

From your point of view it pretty much works the same as any other C-like language.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...