Frogatto Pong


#1

So I decided to take the challenge to create pong in Frogatto. So after working on it till midnight on Saturday, and taking a break on Sunday, I have been plugging away at it all morning (I’m really slow, okay!?).

Here is a screenshot

P.S. yes, I did realize that there are pong materials in the crazy stuff folder, but I only found that out after several hours of hard work and now refuse to even open them up >:(

Also, it appears the download links only appear to those registered and logged-in to the forums are able to see (and subsequently download) the download links, please try out the game, even if just for kicks and giggles!

Installation Instruction:
Place the Cave Place level file into the level section of the data folder
Place the pong_ball file into the item folder of the object folder of the data folder.

Open up frogatto, press control+e to get into the editor and load up the Cave Place level. Press escape to begin play.

07/20/10 - New Version
? Game now is MUCH longer (you can play until my terribly implemented collision detection fails)
? You can have a score (post your highest if you get far enough!)
? Not terribly fun… but getting there ::slight_smile:

07/24/10 - New pong_ball
? Improved collision detection (thanks to some express help from Dave)
note:you only need to re-download the pong_ball.cfg because the Cave Place level has not changed.


Cave Place (6.2 KB)

pong_ball.cfg (4.8 KB)


#2

I’m glad to see someone is taking on my challenge! :slight_smile:

So, I’m not sure if you were expecting to be able to control the behavior of the ant totally in the editor, but for this kind of thing you have to edit the actual FFL. The behavior exposed in the editor only allows making the ant move continually between two points – it won’t be able to track the ball.

To make it follow the ball, open up the level file and find the definition of the platform ant and try adding something like this to its definition:

on_process=“if(facing != desired_facing, set(facing, -facing))
where desired_facing = if(midpoint_x - get_object(level, ‘ball’).midpoint_x < 0, -1, 1)”

This will require making sure the ball object has the label ‘ball’ so that the get_object call will work.

This formula should make it so that the ant always turns toward the ball. Hope that helps, and good luck. :slight_smile:

David


#3

Wonderful, I’ve got the basic first game up and running, points and all. The only things left to do are

  1. fix the really bad collision detection
  2. make the AI lose realistically
  3. powerups, game changers, ect.
  4. less abrupt start-up

I’ll update the OP with the current version


#4

Oh, yeah, playin’ Pong with a paddle that can wall-jump! ;D
You can also load the map through the command line:
./game --level Cave\ Place
(on Linux, I suppose on Mac OS X too?)


#5

[quote=“marcavis, post:4, topic:48”]Oh, yeah, playin’ Pong with a paddle that can wall-jump! ;D
You can also load the map through the command line:
./game --level Cave\ Place
(on Linux, I suppose on Mac OS X too?)[/quote]

Yeah, on macs, all the data files (for any app) are in a folder that “masquerades” as a single, double-clickable program icon. But if you right-click on it, you can see inside it with the menu option “Show Package Contents”.

Inside, there’s Contents/Resources, which contains the data files, and Contents/MacOS, which contains the executable.

So you cd into that Contents/Resources folder (that needs to be the working dir when you run the game), and then just execute:

Because besides that business of app packaging, Macs’ commandlines are pretty straight-up BSD Unix.


#6

You can actually run it without cd’ing into Resources; it’ll cd to the appropriate directory automatically.


#7

Interesting… maybe I could make a .bat that could load the game for you… later though.

BTW, does anyone know how to check for collisions for an object in the current level really easily? Aside from computing the current location of the hitbox manually I can’t seem to find a way to tell the ball it has hit the AI ant. The reason my collision detection fails at high speeds is because it is based on a timer that doesn’t run itself out by the time it reaches the other player at those speeds. Also, some times it becomes possible to double hit your ball at slow speeds, resetting the timer and making it impossible to block your own shot. This is bad. The timer has to go but for me to do it I need to be able to distinguish between hitting the player and hitting the bug.

For the player I can do:

but for the ant all I can do is:

this doesn’t work because the player also has a body area which messes up detection.
I’ve tried several solutions but they all end up crashing the game, these solutions are wide a varied and most look like this:

if(collide_with.bugs, do stuff) if(collide_with.get_object(level, 'AI'), do stuff)
it’s driving me crazy! :’( Can anyone help?


#8

Try something like,

if(collide_with.type = 'ant_black', ...)

#9

facepalm It’s so simple I don’t know why I didn’t find it anywhere else! Thanks, I’ll update in a second with the new version of the pong ball object with drum roll IMPROVED COLLISION DETECTION!!! Boy have I always wanted to say that. If you downloaded the Cave Place level already you don’t need to re-download it for this update because it hasn’t changed, you just need to replace the pong_ball.

This is starting to get very fun! 8)

P.S. Thanks for moving the post to the Mods forum, it was starting to feel out of place in the tech help forum!