Author Topic: 4 games for the PRIME  (Read 9262 times)

0 Members and 1 Guest are viewing this topic.

Offline tgallo

  • LV0 Newcomer (Next: 5)
  • Posts: 2
  • Rating: +0/-0
    • View Profile
4 games for the PRIME
« on: January 08, 2014, 07:48:02 am »
4 games for the PRIME
http://my.tbaytel.net/tgallo/hp prime

Mastermind


Minesweeper


Hangman


Simon

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: 4 games for the PRIME
« Reply #1 on: January 08, 2014, 08:59:06 am »
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.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: 4 games for the PRIME
« Reply #2 on: January 08, 2014, 02:07:16 pm »
Ah, those are for very nice games, great job! :thumbsup:

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 4 games for the PRIME
« Reply #3 on: January 08, 2014, 02:11:45 pm »
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.



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! :)
« Last Edit: January 08, 2014, 02:18:44 pm by DJ Omnimaga »

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: 4 games for the PRIME
« Reply #4 on: January 08, 2014, 03:08:17 pm »
I think FILLPOLY might work too, but I don't know if it can produce circles this smooth.

Not too bad ^^

Code: [Select]
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;

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 4 games for the PRIME
« Reply #5 on: January 08, 2014, 03:25:22 pm »
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.
« Last Edit: January 08, 2014, 03:26:31 pm by DJ Omnimaga »

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: 4 games for the PRIME
« Reply #6 on: January 08, 2014, 03:53:02 pm »
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.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 4 games for the PRIME
« Reply #7 on: January 08, 2014, 04:42:51 pm »
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?

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: 4 games for the PRIME
« Reply #8 on: January 08, 2014, 04:49:43 pm »
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.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 4 games for the PRIME
« Reply #9 on: January 08, 2014, 05:27:40 pm »
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)

Offline tgallo

  • LV0 Newcomer (Next: 5)
  • Posts: 2
  • Rating: +0/-0
    • View Profile
Re: 4 games for the PRIME
« Reply #10 on: January 08, 2014, 11:35:08 pm »
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

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 4 games for the PRIME
« Reply #11 on: January 09, 2014, 12:18:42 am »
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.