Jump to content

How to Make a see-saw in phaser?


kriket
 Share

Recommended Posts

I used tween with sprite rotation as parameter but the body collider of see-saw is not moving with the tweening see-saw sprite. So the player can't really interact with this moving see-saw as he just collides with body which is not moving. Do I have to tween the body collider of this see-saw seperately??

 

Is this standard to tween body collider separately from sprite?

Link to comment
Share on other sites

I needed to make the player interact with the see-saws, ie when player lands on one end of the see-saw, see-saw rotation reacts accordingly (just like real-world see-saw). The problem is,  Player and world are arcade physics enabled, and I reckon P2 on player and world (so basically everywhere), will affect performance a lot. I am targetting mobile, and its a platformer with a few things going on in the scene. 

 

 

Will try to fake the "interactivity" with AngularVelocity and see how far I go. Thanks a lot for all the help and putting me in the right direction. 

Link to comment
Share on other sites

I can obviously set.achor.to(0.5,0.5) and do something like this "sprite.body.angularVelocity = -200;", but any ideas on how to achieve "interactivity"? depending on where the player lands on the see-saw (like in real-world)?

Link to comment
Share on other sites

Applying P2JS on player and the see-saw won't afffect the mobile perfomance as long as you don't use collision callbacks. You can keep the rest of the world moving using arcade physics.

If I enabled P2JS on player, wouldnt that require me to change the rest of the world's (tiled layers) to p2 as well? Else, player wont collide with them. Wrong?

 

For see-saw and player, I wont use callback conditions. Players aim is to just not fall off the see-saws. Thats all

Link to comment
Share on other sites

If I enabled P2JS on player, wouldnt that require me to change the rest of the world's (tiled layers) to p2 as well? Else, player wont collide with them. Wrong?

 

For see-saw and player, I wont use callback conditions. Players aim is to just not fall off the see-saws. Thats all

That's right, but P2JS does not have a big impact on performance and it's the proper way to handle this issue. You should give it a try .

Link to comment
Share on other sites

That's right, but P2JS does not have a big impact on performance and it's the proper way to handle this issue. You should give it a try .

 

Ok, I will try P2JS then and get back with an update later on. thanks again 

Link to comment
Share on other sites

So how non-performant is p2 physics on mobile for a tiled platformer game, if you do decide to have callback functions? I need to have them to play my animations in-game when say one character collides/overlaps with another. thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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