micouy Posted August 24, 2016 Share Posted August 24, 2016 Hi, my problem is collision's callback works only on "bounce" or on the first touch of every collision, idk. My code checks, when player collides platform, then (in other function) if arrow is down it sets sprite's velocity x to 200. This sprite changes velocity only if it "bounces", but doesn't when it's standing on this platform. I set console's log in my function and it also appears, when player is bouncing, not standing . I'm switching from arcade to P2 right now and I'm such a newbie. Could anyone help? (Sorry for my english) code here: drive.google.com/file/d/0B2GJjU5fsrlgYlNhMjF5eWd2Z2s/view?usp=sharing demo here: games.praktik.pl/moon/moon.html Link to comment Share on other sites More sharing options...
symof Posted August 24, 2016 Share Posted August 24, 2016 P2JS should be used for complex physics. https://jsfiddle.net/ya22nbdr/1/ The above example shows how to move on a platform, that is moving and collide with an object. P.S. I would use arcade instead of P2 as it's more efficient on smartphones. Link to comment Share on other sites More sharing options...
micouy Posted August 24, 2016 Author Share Posted August 24, 2016 Thanks, I'll see it later. I'm using P2 because of ability of rotating bodies and creating polygons (I want to use triangular shapes of blocks). I'm not going to release my games on mobiles yet, so it's not a problem. Link to comment Share on other sites More sharing options...
Recommended Posts