Jump to content

P2 objects and update


Recommended Posts

Hello. I'm currently developing my first Phaser game for a school project. It's a simple bow and arrow shoot-em-up, where you shoot birds flying above you.

I was using arcade physics up to the point I realized it's kind of impossible to make the arrow head collide with the birds "logically". Therefore I had to switch to P2.

The birds had a simple function: fly to the end of the playfield and relocate back to their starting point once they're out of the playfield. This was done inside the update function. When I made the birds P2, suddenly I can't access them via the update function anymore.

Here is the github link for the main game code: https://github.com/jeespu/VikingsNewClothes/blob/master/Script/HuntGame.js

So basically my question is, how do I access P2 objects from the update function? I also need to make the arrow (created with the weapon plugin) a P2 object. How would I go about doing that? I'm confused with this whole P2 concept, but I know it's necessary for this kind of collisions. Also feel free to spot other "instances of bad practice" if you happen to spot them. :D

Link to comment
Share on other sites


  • Recently Browsing   0 members

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