Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => HP Prime => Topic started by: tgallo on January 08, 2014, 07:48:02 am
-
4 games for the PRIME
http://my.tbaytel.net/tgallo/hp prime (http://my.tbaytel.net/tgallo/hp prime)
Mastermind
(http://my.tbaytel.net/tgallo/hp prime/mastermind.jpg)
Minesweeper
(http://my.tbaytel.net/tgallo/hp prime/minesweeper.jpg)
Hangman
(http://my.tbaytel.net/tgallo/hp prime/hangman.jpg)
Simon
(http://my.tbaytel.net/tgallo/hp prime/simon.jpg)
-
Nice. I've already tried mastermind from hpcalc.org, I like it.
I see you use a lot concentric circles. I used that too in my very first PPL program. Maybe better (and faster ?) to use FILLPOLY since last update.
-
Ah, those are for very nice games, great job! :thumbsup:
-
That was quite nice. My favorite so far is the Minesweeper game. I often play it. I'll give the Simon's game a try soon.
By the way, a trick to get rid of the weird pixels when using that many circle commands is to copy the screen content in a GROB then paste it (with the background transparent) one pixel below. That said, it depends if you want to use those pixels as an effect or not, though.
(http://img.ourl.ca/simon.png)
I think FILLPOLY might work too, but I don't know if it can produce circles this smooth.
Welcome to the forums by the way! :)
-
I think FILLPOLY might work too, but I don't know if it can produce circles this smooth.
Not too bad ^^
FILLCIRCLE_P(cx, cy, r, color);
EXPORT circles()
BEGIN
RECT();
WHILE GETKEY() == -1 DO
FILLCIRCLE_P(RANDINT(320), RANDINT(240), RANDINT(100), RANDINT(#FFFFFF));
END;
END;
// quick, dirty and not optimal filled circles function
// (yeah, MAKELIST is better :p )
EXPORT FILLCIRCLE_P(cx, cy, r, color)
BEGIN
LOCAL s, cl := {}, angle := HAngle;
HAngle := 1;
FOR s FROM 0 TO 359 STEP 10 DO
LOCAL cp := {};
cp := append(cp, EVAL(r * COS(s) + cx));
cp := append(cp, EVAL(r * SIN(s) + cy));
cl := append(cl, cp);
END;
HAngle := angle;
FILLPOLY_P(cl, color);
END;
-
Oh, I didn't know there was a FILLCIRCLE command too. It was not listed in the commands menu O.O
EDIT: Wait nevermind, it looks like a sub-routine you made. I was confused because it had all-caps.
-
Haha yes sorry, I don't know why I wrote it like that.
Reducing the STEP value increase smoothness but problem occurs with smaller circles. In fact, the smaller the circle, the higher the STEP should be. FILLPOLY doesn't seems to like too close points.
-
Ah I see. I guess it wouldn't be too bad if I used less accurate circles in games, although this can be a problem for games like Simon since it would look weird. Also how fast is this by the way?
-
The speed of the FOR loop (too slow for realtime). COS and SIN could be precomputed but I doubt it would make a big difference.
-
I guess in that case we would need to rely on fake circles (a FILLPOLY made of like 20 points that is just small enough so that it still looks somewhat like a circle or by pre-rendering your circles into a GROB then recalling them with BLIT_P)
-
great to be here!
I got the circle idea from another Prime programmer. I played with GROB but it made the file so much larger.
I tried using ICON yesterday....much smaller than GROB and looks much sharper.
I may update these games in the future
-
Actually the idea I had was to generate circles normally using the circle command, but store the result in a GROB such as G1. That way, it won't increase the program size that much.