Calculator Community > HP Prime

[HP Prime] Tunnel update! (now running at 90 FPS!)

<< < (2/6) > >>

DJ Omnimaga:
Yeah I was worried for a second there. I am still a little annoyed at the width command, though, since it can make it annoying to display long text. However I guess you just have to set the width very high (such as 320 px) and it solves your issues.

What intrigues me are the binary stuff I saw somewhere, because I am curious if we can actually store data in hex or bin then re-use it later for multiple purposes (such as displaying plenty of little pixels or squares to form a sprite/image), rather than having to store our data in a list or something (which are large)?

EDIT: Here's a little test with rectangles, although the emulator runs about 9E999 times faster than the calc, so I had to add extra slowdowns so we can see something. At the end of the screenshot, after modifying some values, the various rectangles display at various locations.

Assuming that the calc display is the same speed as the 39gII or a bit faster, then using rectangles for graphics will most likely rival Nspire Lua speed to a certain extent.

Now to find an efficient way to display Mario...

DJ Omnimaga:
UPDATE: My Tunnel 39gII game has been ported to the HP Prime, but first, I need someone who got the actual calculator (not the emulator) to try the code or the program on their calc, to see if it's too slow or too fast and tell me. Maybe make a video if you can so it is easier for me to help you adjust the speed. :P

Spoiler For "Entire Code":
--- Quote ---EXPORTTunnel()
BEGIN
1->C;
0->P;
100->Y;
20->T;
128->L;
0->L1(512);
FOR Z FROM 0 TO 16 DO
INT(RANDOM(100))->L1(2*Z+1);
60-INT(RANDOM(4))->L1(2*Z+2);
END;
RECT_P(0,0,319,219,RGB(30,100,255),RGB(30,100,255));
RECT_P(0,35,319,219,RGB(0,100,0),RGB(0,100,0));
FOR Z FROM 0 TO 10 DO
TEXTOUT_P("Score:",Z,0,7,RGB(15*Z+100,155-(10*Z),0),250);
TEXTOUT_P("Tunnel Prime",122+Z,0,7,RGB(255-(18*Z),10*Z+99,0),250);
END;
FOR Z FROM 0 TO 4 DO
LINE_P(0,Z+35,319,Z+35,RGB(0,20*Z,0));
END;
WHILE Y>0 DO
FOR Z FROM 0 TO 15 DO
FOR U FROM 0 TO 19999 DO
END;
C+1->C;
IF C>16 THEN
1->C;
END;
L1(2*C+2)->O;
L1(2*C+1)->Q;
RECT_P(20*Z,40,20*Z+19,O,RGB(0,50+Q,0),RGB(0,50+Q,0));
RECT_P(20*Z,O,20*Z+19,O+L,RGB(100+Q,130,50),RGB(100+Q,130,50));
RECT_P(20*Z,O+L,20*Z+19,246,RGB(0,50+Q,0),RGB(0,50+Q,0));
IF Z=0 THEN
RECT_P(0,Y,8,Y+12,RGB(0,0,0),RGB(150,150,255));
RECT_P(2,Y+4,14,Y+8,RGB(0,0,0),RGB(255,0,0));
IF Y<O OR Y+12>O+L THEN
-9->Y;
END;
END;
END;
TEXTOUT_P(P,70,2,6,RGB(0,0,0),200,RGB(50,100,255));
TEXTOUT_P(P,72,2,6,RGB(5,255,255));
P+1->P;
L1(2*C+2)->S;
INT(RANDOM(100))->U;
S+INT(RANDOM(30)-15)->Ans;
IF Ans<45 THEN
45->Ans;
ELSE
IF Ans>213-L THEN
213-L->Ans;
END;
END;
C+1->C;
IF C>16 THEN
1->C;
L-1->L;
END;
Ans->L1(2*C+2);
U->L1(2*C+1);
Y-(5*ISKEYDOWN(2))+(5*ISKEYDOWN(12))->Y;
END;
FOR Z FROM 0 TO 5 DO
INVERT();
FOR Y FROM 0 TO 999 DO
END;
END;
RECT_P(0,15,256,126,0,0);
MSGBOX("SCORE:"+P,1);
END;
--- End quote ---

In the code, you'll see the following:


--- Code: ---FOR U FROM 0 TO 19999 DO
END;
--- End code ---

Just change the 19999 to something smaller or remove it completely to speed up the program.

Screenshot and download below. If you got the HP Prime emulator, close it, then copy the hpprgm file in C:\Users\DJOmnimaga\AppData\Roaming\HP_Prime or whatever is your application data directory.

critor:
Just tested DJ_O's tunnel on the HP-Prime DVT prototype, with the wait-loop removed.

It's faster than flashes! :P


Prepare to include lots of wait-loops in your programs :P

Streetwalrus:
OMG that is fast. *.** Streetwalker wants this calc NAOWZ

TIfanx1999:
Wow, that's fantastic! I think I like it without the wait loops. That's like around the speed of ASM tunnel games on the z80 series. :D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version