Jump to content

Problems with TypeError: game.physics.arcade is undefined


Lysssss
 Share

Recommended Posts

I am new to Phase and js, I had some problems when doing some additional works after finishing the Making your first Phaser game tutorial. I tried to add 5 baddies in the game, I did it using the same way adding stars in the tutorial. However,  I failed to Collide the baddies with the platforms the debugger shows that TypeError: game.physics.arcade is undefined. The player is not collide with the baddies as well I was confused that if I did anything wrong when adding the baddies. The physics system seems doesn't work correctly. Thank you for ur help!

QQ截图20170204032546.png

QQ截图20170204032605.png

QQ截图20170204032710.png

Link to comment
Share on other sites

Hello there!

It seems that you're creating a group for the baddies and then you're not filling the group with baddies. That for loop is only redefining your baddie variable.

I think you're going to want to keep the baddies group variable and delete the baddie variable. Then add to the baddies group in the for loop.

Have a look at this example:

https://phaser.io/examples/v2/groups/add-a-sprite-to-group

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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