Jump to content

P2 pinball game - Struggling with flipper


Recommended Posts

Hello everyone!



I'm new to Phaser, so please bear with me if I have missed anything obvious.


I am currently creating a pinball game, using the P2 physics option, and have managed to setup the level (static object) and ball (standard circle object) easily enough. I have setup gravity etc.


But I am having a lot of problems with the flipper/paddles...




The problem I have is I want to set the flipper to static, but still be able to rotate it using the rotate methods. It doesn't seem like you can do this. Various angle/rotation variables are exposed on the game objects and their bodys, but assigning to these manually has inconsistent effects.


So, I then tried setting the mass to 9999 and gravity to 0 so I can apply nice rotation methods... but I still find it slowly moves off its original position as I apply rotateLeft/Right to it. I could just force it back to its original x/y but that seems a bit poo.


I'd really love to be able to set it to static, and have a nice rotation 'flick' function.




I have found this guy who made a pinball game, and he is using something called "revolutes". I tried copying his code and adjusting just as much as is necessary so it runs on the latest version of phaser (such as updating his math functions), but this always sets my paddle in a negative x,y position.





What really annoys me about his project is that he doesn't seem to be telling the paddles to stay in place (through static or gravity modifiers or any other means that I can spot), they "just do". Does setting up a revolute fix an object into one place?



Hopefully someone can follow along and help. Thank you very much in advance.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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