PONG & SHUTTLE
03-07-2014, 09:24 PM
Post: #1
 Jurgen Keller Senior Member Posts: 317 Joined: Dec 2013
PONG & SHUTTLE
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!
03-08-2014, 07:07 AM
Post: #2
 Mic Member Posts: 131 Joined: Dec 2013
RE: PONG & SHUTTLE
Thank you for sharing !

http://mic.nic.free.fr - Youtube - Facebook
03-09-2014, 11:21 AM
Post: #3
 Tugdual Senior Member Posts: 764 Joined: Dec 2013
RE: PONG & SHUTTLE
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.
Code:
 EXPORT Pong() begin 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:=RGB(255,255,255); //col:=#17DD66h; // Green // 29*8 x 40*8 // Frame rect_p(G1,0,0,319,231,col); rect_p(G1,8,8,312,223,0); // Net for y:=8 to 224 step 16 do rect_p(G1,156,y,163,y+7,col); end; cmp:=14*8; ply:=14*8; vx:=bounce(1,1)*5; vy:=bounce(1,2)*5; frame:=0; // Game loop repeat    t:=ticks+20;    //Move the player    m:=MOUSE;    if size(m(1))>0 then       if m(1,2)>ply then           ply:=ply+5;          if ply>191 then ply:=191; end;       end;       if m(1,2)<ply then           ply:=ply-5;           if ply<9 then ply:=9; end;       end;    end;    //Move the opponent    frame:=frame+1;    if frame mod IP(8-x/40+1) > 0 then       if y>cmp+12 then          cmp:=cmp+5;          if cmp>191 then cmp:=191; end;       end;       if y<cmp+12 then           cmp:=cmp-5;          if cmp<9 then cmp:=9; end;       end;    end;    // Move the ball    x:=x+vx;    y:=y+vy;    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    blit_p(G2,G1);    // Players    rect_p(G2,9,cmp,16,cmp+31,col);    rect_p(G2,304,ply,311,ply+31,col);    // Ball    rect_p(G2,x,y,x+7,y+7,col);    while ticks<t do t:=t; end;    // Final result    blit_p(G0,G2); until iskeydown(4); wait(0); end;
03-10-2014, 08:47 PM
Post: #4
 Jurgen Keller Senior Member Posts: 317 Joined: Dec 2013
RE: PONG & SHUTTLE
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.
 « Next Oldest | Next Newest »

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