Post Reply 
Breakout!
01-04-2014, 06:07 AM (This post was last modified: 01-11-2014 06:29 PM by Egan Ford.)
Post: #1
Breakout!
Caveats, notes, etc...:
  • This was a small POC that quickly got out of hand (feature creep). I really should completely rewrite this.
  • My first HP Prime PPL program (well after "hello, world"). I still have not read the User's manual, I just skimmed what I needed. If you want to offer up suggestions, then do so in this forum.
  • There are about a godzillian optimizations (space and performance) that can be made, however performance optimizations are not necessary. The game can be too fast.
  • The "mouse" is squirrelly at the bottom of the screen. I suspect there is a conflict between the soft buttons and mouse mode. When you grab the paddle, do so above it, then slide your finger below it. As long as you do not run your finger off the bottom or side, you'll be fine.
  • I tried to abstract everything, however I exceeded my time budget on this and took a few shortcuts. Almost everything is customizable.

To play:
  • Tap screen to exit demo mode.
  • Grab the paddle.
  • Hit the ball. You get five balls.
  • Ball travels 2x speed if you hit orange or red bricks, however you can slow down to 1.5 speed if you hit around the center of the paddle.
  • Each level moves down a row of bricks, but resets at level 6,11,etc... Watch the demo mode and example of game play.
  • At game end, tap the screen to reset back to demo mode.
  • "On" to exit.

Video:





Attached File(s)
.zip  breakout.zip (Size: 10.54 KB / Downloads: 259)
Find all posts by this user
Quote this message in a reply
01-04-2014, 06:08 AM
Post: #2
RE: HP Prime Breakout!
2nd video using emulator. Colors look better. But nothing looks better than the real thing.



Find all posts by this user
Quote this message in a reply
01-04-2014, 07:12 AM
Post: #3
RE: HP Prime Breakout!
Very nice! Smile One suggestion I would have for players who are more used to directional controls would be to add d-pad controls allowing the user to press left and right to move the paddle around. With the touch screen it can be akward since your fingers often blocks the ball view, so those who are not used to playing games on a smartphone might have trouble beating just one level.

-DJ Omnimaga
Calculator, mobile & PC game development & art: http://codewalr.us
My music: http://djomnimaga.bandcamp.com/
Visit this user's website Find all posts by this user
Quote this message in a reply
01-04-2014, 09:30 AM
Post: #4
RE: HP Prime Breakout!
(01-04-2014 07:12 AM)Kevin Ouellet Wrote:  Very nice! Smile

+1 Wink
Find all posts by this user
Quote this message in a reply
01-04-2014, 03:57 PM
Post: #5
RE: HP Prime Breakout!
(01-04-2014 07:12 AM)Kevin Ouellet Wrote:  One suggestion I would have for players who are more used to directional controls would be to add d-pad controls allowing the user to press left and right to move the paddle around. With the touch screen it can be awkward since your fingers often blocks the ball view, so those who are not used to playing games on a smartphone might have trouble beating just one level.

The keyboard may be a challenge.

Paddle-based games like Pong and Breakout usually have an absolute value paddle with stops at each end returning a value of 0 - 255 (for 8-bit systems) that can be used to know exactly where to place the paddle. That is how this touchscreen pong also works. Touchscreen challenged players can hold the Prime like a Gameboy and use two thumbs and just touch the screen (not touch-drag) and the paddle will jump to that position. I meant to video that, but forgot. For fat fingers, one can decrement paddle_y at the top of the code to move the paddle up. I tried to place the paddle where one could drag the paddle and have the paddle align with one's fingernail.

Spinner-based games like Arkanoid and Tempest rely on measuring variable velocity or acceleration and the stops are in the software.

Digital d-pads provide neither absolute position or velocity making them poor for paddle and spinner-based games. However ...

I have three possible options for D-pad support:

A. The D-pad is an accelerator. While holding the left or right arrow the paddle accelerates, if left or right is released the paddle could full stop or coast to stop. With full stop I expect most will overshoot and with coast-to-stop there will be some training. Coast-to-stop aligns with button-based games that require acceleration, e.g. Asteroids. I think most could learn this. Rapid breaking can be implemented by using the opposite direction.

B. The D-pad with linear velocity based on the current ball x velocity (e.g. 1.25 * vx * speed adjustment). This would align with the player's desire. If the ball is moving in the +x or -x direction fast, then you want to track it fast, and vv. This would be easier to implement and possibly be easier for users to learn quicker. Releasing left or right would full stop the paddle.

C. Do nothing and hope that users can learn to use the touchscreen. If clearing a level is too hard just change base_ticks to 30, 35, or 40. The game will start out slower and very easy until you hit an orange or red brick, then it will be harder, but not as hard as it is now. Another option would be to change the fast speed (hardcoded) from 2 to 1.5. There are endless permutations to tune this game.
Find all posts by this user
Quote this message in a reply
01-05-2014, 07:54 AM
Post: #6
RE: HP Prime Breakout!
Very impressive !

http://mic.nic.free.fr - Youtube - Facebook
Find all posts by this user
Quote this message in a reply
01-05-2014, 09:20 AM
Post: #7
RE: HP Prime Breakout!
awesome!!
Find all posts by this user
Quote this message in a reply
01-09-2014, 10:32 PM
Post: #8
RE: HP Prime Breakout!
Image search on google for: Atari Breakout
Find all posts by this user
Quote this message in a reply
01-09-2014, 10:50 PM
Post: #9
RE: HP Prime Breakout!
(01-09-2014 10:32 PM)Thomas Klemm Wrote:  Image search on google for: Atari Breakout

AWESOME!
Find all posts by this user
Quote this message in a reply
02-03-2014, 03:32 AM
Post: #10
RE: Breakout!
Hi!
I've downloaded the zip file, unzip it, and there are two files. I can't get it to run, How can I make it run?

Thank you!
Find all posts by this user
Quote this message in a reply
02-03-2014, 05:11 PM (This post was last modified: 02-03-2014 05:11 PM by Egan Ford.)
Post: #11
RE: Breakout!
(02-03-2014 03:32 AM)Dante Wrote:  I've downloaded the zip file, unzip it, and there are two files. I can't get it to run, How can I make it run?

Use the connectivity kit or equiv to upload to your calc the file breakout.hpprgm.
Find all posts by this user
Quote this message in a reply
02-04-2014, 06:24 AM
Post: #12
RE: Breakout!
I use the virtual HP Prime emulator, I've sent the .hpprgm file to the emulator's working folder, then go to program catalog and run it from there, but nothing happens! I maybe doing something wrong.
Find all posts by this user
Quote this message in a reply
02-04-2014, 08:24 PM
Post: #13
RE: Breakout!
Open the source file, and then immediately exit it. This forces the program to be recompiled. The .hpprgrm file contains more than just source code. By recompiling, you are ensuring everything is matched with your calculator. If there is any incompatibility between your settings and the source code, it will show up during this process.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
02-05-2014, 04:26 PM
Post: #14
RE: Breakout!
Hi Han!

What do you mean by opening the source file? you mean open it with the connectivity kit or the Emulator? and I guess the source file is the one without .hpprgrm extension!
Find all posts by this user
Quote this message in a reply
02-05-2014, 05:22 PM
Post: #15
RE: Breakout!
The program suitable for the calculator / emulator is in the .hpprgm file as a UTF-16LE string (sometimes prefixed by binary metadata).
Find all posts by this user
Quote this message in a reply
02-05-2014, 07:16 PM
Post: #16
RE: Breakout!
(02-05-2014 04:26 PM)Dante Wrote:  Hi Han!

What do you mean by opening the source file? you mean open it with the connectivity kit or the Emulator? and I guess the source file is the one without .hpprgrm extension!

After the program has been transferred to the calculator, press [Shift][2] to open the program catalog. Select the program and press [ENTER] to "open" the source file for the program. Then simply hit [ESC] (or better, use "Check" from the menu at the bottom of the screen) to see if there are any errors. Hopefully, there are no errors. What you effectively did was "recompiled" the program.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
02-06-2014, 09:04 PM (This post was last modified: 02-07-2014 04:50 AM by Dante.)
Post: #17
RE: Breakout!
I've downloaded the file from the link above and I've sent both files to the HP Prime working folder on my PC, then launch the HP Prime Virtual Calculator and go to the program catalog [Shift+2], there's only one file called Breakout, I select it and click [Enter] like if I was going to edit it, and there's nothing but the common headers like when you're going to start a new program (I've attached an animated thumbnail). I repeat, there is only one file when you open the calculator's program catalog, I can't see the source file!


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
02-07-2014, 04:46 AM
Post: #18
RE: Breakout!
Looks like you found the issue. A program with no code will do nothing. What version of the emulator are you running? Is it the most recently updated one?

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-04-2015, 06:58 AM
Post: #19
RE: Breakout!
Very nice game!
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)