Lysssss Posted February 4, 2017 Share Posted February 4, 2017 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! Link to comment Share on other sites More sharing options...
Rydez Posted February 4, 2017 Share Posted February 4, 2017 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 More sharing options...
samme Posted February 4, 2017 Share Posted February 4, 2017 game.physics.aracde.collide(baddie, platforms); is a misspelling (so undefined). Also it should probably be collide(baddies, platforms) (the whole group) but as Rydez said you'll have to add sprites to the group. Link to comment Share on other sites More sharing options...
Lysssss Posted February 4, 2017 Author Share Posted February 4, 2017 Thank you guys soo much for your help! Problem solved! Link to comment Share on other sites More sharing options...
Recommended Posts