Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - Simple breakout game

Years of Service
User Offline
Joined: 28th May 2011
Posted: 2nd Jun 2011 00:17 Edited at: 3rd Jun 2011 00:53
This is my second game.
it's a work in progress but I thought I'd share.
After all, sharing is caring

[edit] edited the code to delete any remaining sprites before showing the menu[/edit]

There is one bug I need to iron out, the ball sometimes vanishes when it hits the edge of the bat.

Constructive criticism is very welcome.

[edit] I fixed the bug and added a few changes to the code. I'll keep updating it seeing as I've had such a fantastic response....[/edit]
FPSC Developer
Years of Service
User Offline
Joined: 3rd Jul 2009
Location: pittsburgh, pa.
Posted: 11th Jun 2011 20:11
don't worry about the number of responces you get. i'm sure a lot of people will find this handy and a good learning experience. it works well. i sugguest putting a little pause before the ball re-enters the play field just to give the player a moment to re-adjust.

thanks for sharing your code

gamer, lover, filmmaker
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 2nd Aug 2011 02:39
Great example, thank you for sharing.

Question: On my system this runs so fast I never get a chance to move the bar before the game is over ...

Is the game engine supposed to be compensating for the clock frequency on my computer or is something the coder is supposed to accommodate for?
Years of Service
User Offline
Joined: 7th Aug 2010
Location: United States
Posted: 29th Aug 2011 07:24 Edited at: 29th Aug 2011 07:25
Hey erebusman. If you would like to slow the game down, at the top of the code....


rem hide the mouse set up sync etc etc etc

backdrop on:autocam off:hide mouse:sync on:sync rate 0

Where it says sync rate, change it to something such as 60.

So this line would read.
backdrop on:autocam off:hide mouse:sync on:sync rate 60

Great example Sheff.

rem allow user create game with one click
rem create graphics, sound, scripts, models, with one click
rem slap user in face if game choice is mmo

Login to post a reply

Server time is: 2024-02-24 20:51:02
Your offset time is: 2024-02-24 20:51:02