HP Forums
PONG & SHUTTLE - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: PONG & SHUTTLE (/thread-847.html)

PONG & SHUTTLE - Jurgen Keller - 03-07-2014 09:24 PM

I played around with the HP Prime and just wanted to share the results with you. First, there is the SHUTTLE program which draws a Space Shuttle from vector data I once converted from an old AutoCAD DWG file. Completely useless but nice graphics.

The second is PONG, the mother of all Arcade games. It features 3 modes (1 Player, 2 Players, Demo) and 3 difficulty levels. This project caused me some sleepless nights. Even such a simple program takes quite some efforts until it's really playable and fun. Please note that you should play it on a real Prime, not in the emulator (there it runs much too fast).

You can download the programs here (sorry, pages in German, however, I'm sure you'll find the download links):
Enjoy, have fun!

RE: PONG & SHUTTLE - Mic - 03-08-2014 07:07 AM

Thank you for sharing !

RE: PONG & SHUTTLE - Tugdual - 03-09-2014 11:21 AM

Thanks for sharing. The shuttle is a total show off application ha ha ha.
Pong is far from being fluid. I had started something which was I think a bit better (especially on the physical device) but then I lost interest and never spent more time. May be the frame rate would have dropped once completed... I deleted the WIP topic, so here is the original code if anybody interested in working on it.

local col,m,vx,vy,x,y,cmp,ply;
local t,frame;
local bounce:={{.342,.940},{.707,.707},{.866,.5},{1,0}};
dimgrob_p(G1, 320, 240); // Background
dimgrob_p(G2, 320, 240); // Playground
//col:=#17DD66h; // Green

// 29*8 x 40*8

// Frame
// Net
for y:=8 to 224 step 16 do rect_p(G1,156,y,163,y+7,col); end;


// Game loop
   //Move the player
   if size(m(1))>0 then
      if m(1,2)>ply then 
         if ply>191 then ply:=191; end;
      if m(1,2)<ply then 
         if ply<9 then ply:=9; end;

   //Move the opponent
   if frame mod IP(8-x/40+1) > 0 then
      if y>cmp+12 then
         if cmp>191 then cmp:=191; end;
      if y<cmp+12 then 
         if cmp<9 then cmp:=9; end;

   // Move the ball
   if y<8 then y:=8; vy:=-vy; end;
   if y>215 then y:=215; vy:=-vy; end;
   if x<8 then x:=8; vx:=-vx; end;
   if x>304 then x:=304; vx:=-vx; end;

   // Background
   // Players
   // Ball

   while ticks<t do t:=t; end;

   // Final result
until iskeydown(4);

RE: PONG & SHUTTLE - Jurgen Keller - 03-10-2014 08:47 PM

Thanks for your feedback.

(03-09-2014 11:21 AM)Tugdual Wrote:  Pong is far from being fluid.
Your program runs indeed smoother on the emulator. On the real Prime, however, I don't see that much difference. During development, I noticed a decrease in performance while adding features. I have to do some further experiments to determine which parts need optimization to make the game more fluent.

BTW, one thing I learned while developing PONG is that the TEXTOUT_P command accepts a wider range for the font size parameter than documented in the manual. Values > 2 will result in larger fonts, and if I remember correctly, the largest accepted value is 7.