Jump to content

Why it doesn't add to group?


przemoo83
 Share

Recommended Posts

Hi
I don't know what is wrong with my code. From what I understand from documentation using 'group.create()' method should add an element to a group and therefore increase group.length. However, it still logs "1" to a console no matter how many objects I add. Can anyone look at this code please?

http://phaser.io/sandbox/dUeskoXP

It adds a sprite everytime you click on the screen.

 

 

Link to comment
Share on other sites

Because every time showMe is called it's creating a brand new Group (set to the LOCAL var "myGroup") and adding just one sprite to it. So what is actually happening is you're making a new Group on each click, not adding to an existing one.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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