Author Topic: Stick with me  (Read 3870 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Stick with me
« on: November 13, 2019, 04:14:04 pm »
Ever wonder how cats score points when they start chasing a laser beam? ;-))
Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32) 'Stick with me.bas 2019-11-13 as per Ken's Inform
  2. start = TIMER
  3. haha:
  4. cnt = cnt + 1
  5. IF cnt MOD 20 = 1 THEN bx = RND * 800: by = RND * 600
  6. FOR r = 100 TO 0 STEP -10
  7.     IF r \ 10 MOD 2 THEN c~& = &HFFFF0000 ELSE c~& = &HFFFFFFFF
  8.     LINE (bx - r / 2, by - r / 2)-STEP(r, r), c~&, BF
  9. mx = _MOUSEX: my = _MOUSEY
  10. IF ((mx - bx) ^ 2 + (my - by) ^ 2) ^ .5 < 50 THEN hits = hits + 1
  11. _TITLE "Stick with me: " + STR$(hits - 2 * (TIMER - start) \ 1)
  12. GOTO haha
  13.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Stick with me
« Reply #1 on: November 13, 2019, 06:23:23 pm »
Bplus, I hope you got this idea from my Inform game. lol

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Stick with me
« Reply #2 on: November 13, 2019, 11:04:43 pm »
Bplus, I hope you got this idea from my Inform game. lol

Sort a, "as per Ken's Inform" it started out as what I imagined it might be like, then I improved on that by getting rid of clicking and made scoring based on time. Didn't notice you only moved the target when the mouse was entering it.

Then I realized I was acting just like a cat trying to catch a light beam. ;-))
« Last Edit: November 13, 2019, 11:17:54 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Stick with me
« Reply #3 on: November 13, 2019, 11:33:05 pm »
LOL! Awesome. :)

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Stick with me
« Reply #4 on: November 22, 2019, 07:30:41 am »
Nice hand/eye coordination exercise there.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Stick with me
« Reply #5 on: November 22, 2019, 10:59:34 am »
Ha! Isn't this the basic essence of every shooter game? The cat chasing a light beam... oh wait! I have an idea for mod!

stay tuned...

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Stick with me
« Reply #6 on: November 22, 2019, 11:34:47 am »
A "BUT Don't Stick ME!"  mod!

Code: QB64: [Select]
  1. _TITLE "Stick with me but Don't Stick ME." 'b+ mod 2019-11-22
  2. SCREEN _NEWIMAGE(800, 600, 32) 'Stick with me.bas 2019-11-13 as per Ken's Inform
  3. start = TIMER
  4. haha:
  5. cnt = cnt + 1
  6. IF cnt MOD 20 = 1 THEN
  7.     bx = RND * 800: by = RND * 600
  8.     IF RND < .25 THEN DontStickMe = -1 ELSE DontStickMe = 0
  9. IF DontStickMe THEN
  10.     LINE (bx - 50, by - 50)-STEP(100, 100), &HFFFFFFFF, BF
  11.     FOR r = 100 TO 0 STEP -10
  12.         IF r \ 10 MOD 2 THEN c~& = &HFFFF0000 ELSE c~& = &HFFFFFFFF
  13.         LINE (bx - r / 2, by - r / 2)-STEP(r, r), c~&, BF
  14.     NEXT
  15. mx = _MOUSEX: my = _MOUSEY
  16. IF ((mx - bx) ^ 2 + (my - by) ^ 2) ^ .5 < 50 THEN
  17.     IF DontStickMe THEN
  18.         BEEP: hits = hits - 20
  19.     ELSE
  20.         hits = hits + 2
  21.     END IF
  22. _TITLE "Score now is: " + STR$(hits - 2 * (TIMER - start) \ 1)
  23. GOTO haha
  24.  
  25.