Pong FP Implementation


(B6ka) #1

Hello everyone,

I am looking for an FP implementation of a pong game with more realistic ball physics. For example, I would like the ball to bounce off from polygon objects with proper angle. Something like the picture below. I would like to have complex polygons (maybe also circles) inside the field.

I suppose this is best done using the pixel-perfect collision with pixel masks, so I would also appreciate a link to a tutorial about that. Cheers.


(Mike Evmm) #2

Using Nape might also be a good idea, since it’d allow you to integrate as-complex-as-you-want physics without much hassle.


(Zachary Lewis) #3

You’d probably be best off using polygons instead of pixels. Metanet’s tutorials are really good and would probably be a great place for you to start.

Or, you could just implement Box2D and let it do the work, but where’s the fun in that?


(B6ka) #4

Thanks, guys, for very useful suggestions :slight_smile: . I am not sure if I want to use physics engine, I want the game to run smoothly and do not really need to much of physics to justify the engine. I will probably do the collision myself. I was hoping maybe somebody here already had a basic version and was willing to share.

Btw, Nape says it is a few times faster than Box2D.


(Hussein Tammam) #5

I’ve tested nape before in much more complex scenes and its pretty damn fast :). The performance hit with one dynamic object (the ball) in the world is virtually nonexistent. A game like this is really easy to make with nape. Or you could just go the hard/fun route and do what @zachwlewis said ^^

P.S: IMO, Nape physics is pretty much superior to Box2D in every way. The only downside is the lack of resources concerning nape.


(Mike Evmm) #6

100% agree. One of the worst parts of working with nape was getting started - the only real resource you have is the nape website manual and demos’ code, which aren’t always that great. Once I got used to the API, it was pretty smooth.


(Oli) #7

hey man im rly struggling getting started with nape. Do you have any early build of a project that uses flashpunk simultaneously I could use as a base. If so i would really appreciate


(B6ka) #8

I found this basic setup on their forum. Have not really tested it but here is the link


(Oli) #9

lol thats me, im still trying to implement it! ahah


(B6ka) #10

haha, OK, good luck :slight_smile:


(Mike Evmm) #11

There’s nothing I can give you right now, but you can maybe take a look at how HaxeFlixel does it. It’s Haxe, and it’s Flixel, but from what I see it should be fairly easy to port. If you do it, please share! In the meantime, I’ll see if I can write some sort of template. Maybe @Copying is interested as well?


(Martí Angelats i Ribera) #12

I’ve never used Haxe so far and so far i’ve got enough work with other projects (remember, i’m rewritting the library from 0). But i’ll bookmark it for the future :wink:


(Hussein Tammam) #13

Hey I think I had a project with nape entities in them. If you still need need help I could clean it up and send it to you.

Just gotta finish up my personal statement >.>


(Oli) #14

That would be awesome dude:) thx so much