not-superman Posted August 18, 2015 Share Posted August 18, 2015 PNG image has a transparent area that collides with another PNG image. How to make faces only nontransparent parts of images.I hope you understand what I mean. Link to comment Share on other sites More sharing options...
tips4design Posted August 18, 2015 Share Posted August 18, 2015 You can add a polygonal shape body to the image (instaed of the default rectangular one) si it is more accurate related to your image. http://phaser.io/examples/v2/p2-physics/body-debug BrunoHautenfaust and not-superman 2 Link to comment Share on other sites More sharing options...
not-superman Posted August 26, 2015 Author Share Posted August 26, 2015 You can add a polygonal shape body to the image (instaed of the default rectangular one) si it is more accurate related to your image. http://phaser.io/examples/v2/p2-physics/body-debugArcade Phisics doesn't support polygons? Link to comment Share on other sites More sharing options...
tips4design Posted August 26, 2015 Share Posted August 26, 2015 Arcade physics is very limited, if you want more advanced collisions you can use P2 physics. not-superman 1 Link to comment Share on other sites More sharing options...
not-superman Posted August 26, 2015 Author Share Posted August 26, 2015 Arcade physics is very limited, if you want more advanced collisions you can use P2 physics.I use an animation of the sprite sheet. Is there a way to set polygons for each frame? Link to comment Share on other sites More sharing options...
Skeptron Posted August 27, 2015 Share Posted August 27, 2015 I don't think so (in ARCADE). But you can shrink the body of your animated object, maybe it could be enough for your use-case. Link to comment Share on other sites More sharing options...
BrunoHautenfaust Posted August 27, 2015 Share Posted August 27, 2015 To shrink the collision body size in ARCADE use this line: player.body.setSize(width, height, x, y); You can set the collision body size for each animation that way. But for each frame... I don't know. I like the P2 physics polygons. Looks very accurate. Almost pixel perfect. However, isn't that heavy on the processor? To constantly check if a bunch of polygons are colliding with other things? Or it's not that much of a deal since the sprite's collision body is divided in many polygons and it's not just one big shape following its contours? (I am looking at the example link from tips4design). Link to comment Share on other sites More sharing options...
tips4design Posted August 27, 2015 Share Posted August 27, 2015 Well, polygon collision each much better than checking each pixel of the image individually... Another think you could do is (I don't know if it's possible in ARCADE) to add multiple square bodies to a single sprite, so you have like 4-5 overlapping rectangles that better match the actual shape of your sprite. Link to comment Share on other sites More sharing options...
not-superman Posted August 27, 2015 Author Share Posted August 27, 2015 Well, polygon collision each much better than checking each pixel of the image individually... Another think you could do is (I don't know if it's possible in ARCADE) to add multiple square bodies to a single sprite, so you have like 4-5 overlapping rectangles that better match the actual shape of your sprite.How to add? Link to comment Share on other sites More sharing options...
tips4design Posted August 27, 2015 Share Posted August 27, 2015 I think only P2JS supports multiple shapes/body ;( Link to comment Share on other sites More sharing options...
BrunoHautenfaust Posted August 27, 2015 Share Posted August 27, 2015 How to add? If you mean how to add P2JS: game.physics.startSystem(Phaser.Physics.P2JS); From there on you should have access to all functionalities P2JS has to offer. Link to comment Share on other sites More sharing options...
not-superman Posted August 27, 2015 Author Share Posted August 27, 2015 How to add multiple square bodies?) Link to comment Share on other sites More sharing options...
tips4design Posted August 27, 2015 Share Posted August 27, 2015 http://phaser.io/docs/2.4.2/Phaser.Physics.P2.Body.html#methods Link to comment Share on other sites More sharing options...
Recommended Posts