Sign in to follow this  
Alastair

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.

 

http://georgiee.github.io/phaserpinball/

https://github.com/georgiee/phaserpinball/tree/master/source/javascripts

 

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.