Jump to content

Platformer: Arcade or Arcarde + P2?


Recommended Posts

Hey guys!


It's been a while but I finally have some free time on my hand and decided to give Phaser another go.

So with all the new fancy an new possibilities regarding physics I have a question for you guys.


I am currently building a simple platformer. Current stage is mostly drawing assets designing levels etc. but I even did some prototyping today and ended up with my Top1 awkward platformer problem:





As you might suspect I am using the arcarde physics and my player model (black thingie) is a simple sprite that gets stuck at the edge of the platform while moving up.


So here is the Question:

Should I stick with arcade all the way and slice my player into 2 smaller boxes (top and bottom part) that move along together (in case that's not a big no-no already) or should I use the new p2 physics for my player collision?


All I want is to get rid of the awkward hitbox that comes with the sprite. The player will otherwise only collide with other enemy/item sprites where Arcade physic are more appropriate. :/



I did some research, checked the p2 examples and found this thread among others but couldn't find any examples that allowed me to get a arcade/p2 hybrid platformer running where the player collides with sprites handled by the arcade physics. I tried some approaches but it ended up not working.



Do you have a hint or even a snipped for me on how to approach this problem?


Greetings and thanks! :)

Link to comment
Share on other sites

I've never tried overlaying two bodies in a sprite before (you'd do this by using addChild to create two more null sprites inside the main sprite and use body.setSize on each to create probably a wide short rectangle to cover the 'feet' and then a tall one to cover the 'body') but I can't imagine Phaser would handle it well. I think your only realistic option is P2...

Link to comment
Share on other sites


  • Recently Browsing   0 members

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