Author Topic: how to - x axis?  (Read 5975 times)

0 Members and 1 Guest are viewing this topic.

FellippeHeitor

  • Guest
Re: how to - x axis?
« Reply #15 on: February 19, 2020, 10:25:05 pm »
I upgraded the forum software this morning and lost some of the customisation, specifically the QB64 codebox. Just restored it.

No correlation with the delays of yore.

Now if only I could remember how I'd added the [Select] link...
« Last Edit: February 19, 2020, 10:27:44 pm by FellippeHeitor »

FellippeHeitor

  • Guest
Re: how to - x axis?
« Reply #16 on: February 19, 2020, 10:46:34 pm »
Code: QB64: [Select]
  1. PRINT "Select is back"

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: how to - x axis?
« Reply #17 on: February 19, 2020, 10:58:35 pm »
Hi Fellippe,

I apologize for being so off topic (Terry started it) but did you do something about delays or has the twilight zone just drifted away for awhile?

FellippeHeitor

  • Guest
Re: how to - x axis?
« Reply #18 on: February 19, 2020, 11:05:10 pm »
As I told you, I upgraded the forum software this morning. That surely put things in place.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: how to - x axis?
« Reply #19 on: February 19, 2020, 11:36:33 pm »
Great! Oh that's what you mean by delays of yore. :)
« Last Edit: February 19, 2020, 11:37:52 pm by bplus »

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: how to - x axis?
« Reply #20 on: February 20, 2020, 12:29:37 am »
Code: QB64: [Select]
  1. PRINT "Select is back"

Sweet ... sorry to get off topic. I noticed the change after I posted the code. Should have started a new topic.
In order to understand recursion, one must first understand recursion.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: how to - x axis?
« Reply #21 on: February 20, 2020, 12:42:17 am »
Terry, I hope you know I was kidding when I said you started it, ha! You and Old Moses did great job of answering codevsb12, original post IMO, I thought we were done anyway.

Time will tell or codevsb12 :)

Is this really homework? I'd kill for homework like this when I was in school!

No, I think someone had older QB and just found QB64.
« Last Edit: February 20, 2020, 12:48:33 am by bplus »

Offline codevsb12

  • Newbie
  • Posts: 23
    • View Profile
Re: how to - x axis?
« Reply #22 on: February 20, 2020, 05:55:47 pm »
great

one last thing, there was supposed to be a border around the screen and its not being drawn over when i use the line statement.

same to my circle.
« Last Edit: February 20, 2020, 06:29:36 pm by codevsb12 »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: how to - x axis?
« Reply #23 on: February 20, 2020, 07:27:34 pm »
great

one last thing, there was supposed to be a border around the screen and its not being drawn over when i use the line statement.

same to my circle.

Here is Old Moses code with a frame around the screen,
Code: QB64: [Select]
  1. DEFINT A-Z
  2. main& = _NEWIMAGE(600, 400, 32)
  3. sprite& = _NEWIMAGE(21, 31, 12)
  4. _DEST sprite&
  5. FOR y = 0 TO 29
  6.     FOR x = 0 TO 20
  7.         READ sprt%: PSET (x, y), sprt%
  8.     NEXT x
  9. _DEST main&
  10. SCREEN main&
  11. xp = 64
  12. yp = 70
  13. sx = 0: sy = 0: sx2 = 20: sy2 = 30
  14.  
  15.     CLS
  16.     FOR i = 0 TO 10 'framed
  17.         LINE (0 + i, 0 + i)-(_WIDTH - i, _HEIGHT - i), _RGB32(255 - i * 10, 128 - i * 5, 64 - i * 3), B
  18.     NEXT
  19.     te$ = INKEY$
  20.     IF te$ = "d" THEN xp = xp + 2: sx = 0: sy = 0: sx2 = 20: sy2 = 30
  21.     IF te$ = "a" THEN xp = xp - 2: sx = 20: sy = 0: sx2 = 0: sy2 = 30
  22.     IF te$ = "w" THEN yp = yp - 2
  23.     IF te$ = "s" THEN yp = yp + 2
  24.     IF te$ = "q" THEN END
  25.  
  26.     _PUTIMAGE (xp, yp), sprite&, main&, (sx, sy)-(sx2, sy2)
  27.     _DISPLAY
  28.  
  29. DATA 00,00,00,00,00,00,00,00,14,14,14,14,14,00,00,00,00,00,00,00,00
  30. DATA 00,00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,00,00,00
  31. DATA 00,00,00,00,00,00,14,14,14,14,00,14,14,14,14,00,00,00,00,00,00
  32. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,00,00,00,00
  33. DATA 00,00,00,00,00,00,14,14,14,14,14,14,00,00,00,00,00,00,14,14,00
  34. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,14,14,14,14
  35. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,14,14,00,00,14,14,14,14
  36. DATA 00,00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,14,14,00
  37. DATA 00,00,00,00,00,00,00,00,14,14,14,14,14,00,00,00,00,00,14,14,00
  38. DATA 00,00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,14,14,00
  39. DATA 00,00,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,00
  40. DATA 00,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,00,00
  41. DATA 00,14,14,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  42. DATA 00,14,14,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  43. DATA 00,14,14,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  44. DATA 14,14,14,14,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  45. DATA 14,14,14,14,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  46. DATA 00,14,14,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  47. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  48. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  49. DATA 00,00,00,00,00,14,14,14,14,14,00,14,14,14,14,14,00,00,00,00,00
  50. DATA 00,00,00,00,00,14,14,14,14,00,00,00,14,14,14,14,00,00,00,00,00
  51. DATA 00,00,00,00,14,14,14,14,14,00,00,00,14,14,14,14,00,00,00,00,00
  52. DATA 00,00,00,00,14,14,14,14,00,00,00,00,00,14,14,14,14,00,00,00,00
  53. DATA 00,00,00,14,14,14,14,14,00,00,00,00,00,14,14,14,14,00,00,00,00
  54. DATA 00,00,00,14,14,14,14,00,00,00,00,00,00,14,14,14,14,00,14,14,00
  55. DATA 00,00,14,14,14,14,14,00,00,00,00,00,00,14,14,14,14,14,14,14,00
  56. DATA 00,00,00,14,14,14,14,14,14,00,00,00,00,14,14,14,14,14,14,14,00
  57. DATA 00,00,00,00,14,14,14,14,14,00,00,00,14,14,14,14,14,14,00,00,00
  58. DATA 00,00,00,00,00,14,14,14,00,00,00,00,00,14,14,00,00,00,00,00,00
  59.  
  60.  
  61.  

same with circle ????

Offline codevsb12

  • Newbie
  • Posts: 23
    • View Profile
Re: how to - x axis?
« Reply #24 on: February 20, 2020, 08:40:50 pm »
ok, lets test it out. btw idk why you made all those things with rgb32 bu- OMG this is way better than i had in mind!

and there's a thing you guys may be confused about. my game is about a player having to collect a bouncing ball before it touches on a spike. i'm now feeling a little bit noob for having to copy paste everything the proes make to me.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: how to - x axis?
« Reply #25 on: February 20, 2020, 10:17:18 pm »
Quote
OMG this is way better than i had in mind!

;-)) Have a ball!

Code: QB64: [Select]
  1. 'DEFINT A-Z
  2. main& = _NEWIMAGE(600, 400, 32)
  3. sprite& = _NEWIMAGE(21, 31, 12)
  4. _DEST sprite&
  5. FOR y = 0 TO 29
  6.     FOR x = 0 TO 20
  7.         READ sprt%: PSET (x, y), sprt%
  8.     NEXT x
  9. _DEST main&
  10. SCREEN main&
  11. xp = 64
  12. yp = 70
  13. sx = 0: sy = 0: sx2 = 20: sy2 = 30
  14. bx = _WIDTH / 2: by = _HEIGHT / 2
  15. bdx = 2 * (RND * 5 - 2.5): bdy = 2 * (RND * 5 - 2.5)
  16.     CLS
  17.     FOR i = 0 TO 10 'framed
  18.         LINE (0 + i, 0 + i)-(_WIDTH - i, _HEIGHT - i), _RGB32(255 - i * 10, 128 - i * 5, 64 - i * 3), B
  19.     NEXT
  20.     te$ = INKEY$
  21.     IF te$ = "d" THEN xp = xp + 2: sx = 0: sy = 0: sx2 = 20: sy2 = 30
  22.     IF te$ = "a" THEN xp = xp - 2: sx = 20: sy = 0: sx2 = 0: sy2 = 30
  23.     IF te$ = "w" THEN yp = yp - 2
  24.     IF te$ = "s" THEN yp = yp + 2
  25.     IF te$ = "q" THEN END
  26.  
  27.  
  28.     _PUTIMAGE (xp, yp), sprite&, main&, (sx, sy)-(sx2, sy2)
  29.     drawBall bx, by
  30.     bx = bx + bdx: by = by + bdy
  31.     IF bx < 20 THEN bx = 20: bdx = -bdx
  32.     IF bx > _WIDTH - 20 THEN bx = _WIDTH - 20: bdx = -bdx
  33.     IF by < 20 THEN by = 20: bdy = -bdy
  34.     IF by > _HEIGHT - 20 THEN by = _HEIGHT - 20: bdy = -bdy
  35.  
  36.     _DISPLAY
  37.     _LIMIT 60
  38.  
  39. DATA 00,00,00,00,00,00,00,00,14,14,14,14,14,00,00,00,00,00,00,00,00
  40. DATA 00,00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,00,00,00
  41. DATA 00,00,00,00,00,00,14,14,14,14,00,14,14,14,14,00,00,00,00,00,00
  42. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,00,00,00,00
  43. DATA 00,00,00,00,00,00,14,14,14,14,14,14,00,00,00,00,00,00,14,14,00
  44. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,14,14,14,14
  45. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,14,14,00,00,14,14,14,14
  46. DATA 00,00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,14,14,00
  47. DATA 00,00,00,00,00,00,00,00,14,14,14,14,14,00,00,00,00,00,14,14,00
  48. DATA 00,00,00,00,00,00,00,14,14,14,14,14,14,14,00,00,00,00,14,14,00
  49. DATA 00,00,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,00
  50. DATA 00,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,00,00
  51. DATA 00,14,14,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  52. DATA 00,14,14,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  53. DATA 00,14,14,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  54. DATA 14,14,14,14,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  55. DATA 14,14,14,14,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  56. DATA 00,14,14,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  57. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  58. DATA 00,00,00,00,00,00,14,14,14,14,14,14,14,14,14,00,00,00,00,00,00
  59. DATA 00,00,00,00,00,14,14,14,14,14,00,14,14,14,14,14,00,00,00,00,00
  60. DATA 00,00,00,00,00,14,14,14,14,00,00,00,14,14,14,14,00,00,00,00,00
  61. DATA 00,00,00,00,14,14,14,14,14,00,00,00,14,14,14,14,00,00,00,00,00
  62. DATA 00,00,00,00,14,14,14,14,00,00,00,00,00,14,14,14,14,00,00,00,00
  63. DATA 00,00,00,14,14,14,14,14,00,00,00,00,00,14,14,14,14,00,00,00,00
  64. DATA 00,00,00,14,14,14,14,00,00,00,00,00,00,14,14,14,14,00,14,14,00
  65. DATA 00,00,14,14,14,14,14,00,00,00,00,00,00,14,14,14,14,14,14,14,00
  66. DATA 00,00,00,14,14,14,14,14,14,00,00,00,00,14,14,14,14,14,14,14,00
  67. DATA 00,00,00,00,14,14,14,14,14,00,00,00,14,14,14,14,14,14,00,00,00
  68. DATA 00,00,00,00,00,14,14,14,00,00,00,00,00,14,14,00,00,00,00,00,00
  69.  
  70. SUB drawBall (x, y)
  71.     FOR r = 0 TO 10 STEP .25
  72.         CIRCLE (x, y), r, _RGB32(255 - r * 10, 150 - r * 10, 0)
  73.     NEXT
  74.  
« Last Edit: February 20, 2020, 10:19:08 pm by bplus »

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: how to - x axis?
« Reply #26 on: February 20, 2020, 11:23:56 pm »
Code: [Select]
deflng a-z
const sw = 640
const sh = 480
screen _newimage(sw, sh, 32)

w = 400
h = 400
dim a as double, b as double
a = 0.08
b = 0.03

line (0,0)-(sw,sh),_rgb(237,221,255),bf
for y=0 to h
for x=0 to w
if (sqr((x + a*w)^2 + (y - h/2)^2) > (w/2 + b*w)) and (sqr((x - w - a*w)^2 + (y - h/2)^2) > (w/2 + b*w)) or (sqr((y + a*h)^2 + (x - w/2)^2) > (h/2 + b*h)) and (sqr((y - h - a*h)^2 + (x - w/2)^2) > (h/2 + b*h))then pset (sw/2 - w/2 + x, sh/2 + h/2 - y),_rgb(187,0,0)
next
next

sleep
system

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: how to - x axis?
« Reply #27 on: February 21, 2020, 06:49:14 am »
ok, lets test it out. btw idk why you made all those things with rgb32 bu-

_RGB32 is the heart of the border effect. It sets the colors of each concentric line box. Giving over 16.7 million color combinations. The suntax is:

_RGB32(red component, green component, blue component) with each color component being a value between 0-255

Bplus is taking advantage of the fact that I set up a 32bit color main screen and using a 32 bit color scheme, subtly shading each color component at different rates for each iteration of the border loop to give it a picture frame effect.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: how to - x axis?
« Reply #28 on: February 21, 2020, 12:24:37 pm »
Holy Tilapia _vince!

Code: QB64: [Select]
  1. _TITLE "Holy Tilapia" ' _vince 2020-02-21  https://www.qb64.org/forum/index.php?topic=2204.msg114487#msg114487
  2. ' overlay b+ version
  3. 'DEFLNG A-Z
  4. CONST xmax = 500, ymax = 500, white = &HFFFFFFFF, red = &HFFBB0000
  5. CONST sw = 640 ' to match b+  640 original
  6. CONST sh = 480 ' ditto        480 original
  7. SCREEN _NEWIMAGE(sw, sh, 32)
  8.  
  9. ' b+ code prep for overlay ============================================
  10. TC& = _NEWIMAGE(xmax, ymax, 32)
  11. _DEST TC&
  12. LINE (50, 50)-(450, 450), red, BF
  13. CIRCLE (0, 250), 220, white
  14. CIRCLE (500, 250), 220, white
  15. CIRCLE (250, 0), 220, white
  16. CIRCLE (250, 500), 220, white
  17. PAINT (150, 150), white
  18. PAINT (350, 150), white
  19. PAINT (150, 350), white
  20. PAINT (350, 350), white
  21. FOR r = 29 TO 45 STEP .25
  22.     CIRCLE (250, 250), r, red
  23.  
  24. '=======================================================================
  25.  
  26. ' vince code  ==========================================================
  27. w = 400
  28. h = 400
  29. a = 0.08
  30. b = 0.03
  31.  
  32. LINE (0, 0)-(sw, sh), _RGB(237, 221, 255), BF
  33. FOR y = 0 TO h
  34.     FOR x = 0 TO w
  35.         IF (SQR((x + a * w) ^ 2 + (y - h / 2) ^ 2) > (w / 2 + b * w)) AND (SQR((x - w - a * w) ^ 2 + (y - h / 2) ^ 2) > (w / 2 + b * w)) OR (SQR((y + a * h) ^ 2 + (x - w / 2) ^ 2) > (h / 2 + b * h)) AND (SQR((y - h - a * h) ^ 2 + (x - w / 2) ^ 2) > (h / 2 + b * h)) THEN PSET (sw / 2 - w / 2 + x, sh / 2 + h / 2 - y), _RGB(187, 0, 0)
  36.     NEXT
  37.  
  38. ''' overlay b+ cross +++++++++++++++++++++++++++++++++++++++++++++++++++++
  39. FOR y = 0 TO ymax - 20
  40.     FOR x = 0 TO xmax
  41.         _SOURCE TC&
  42.         IF POINT(x, y) = red THEN bRed = -1 ELSE bRed = 0
  43.         _SOURCE 0
  44.         IF POINT(x + 70, y - 10) = red THEN vRed = -1 ELSE vRed = 0
  45.  
  46.         IF bRed AND vRed THEN
  47.             PSET (x + 70, y - 10), &HFF880088
  48.         ELSEIF bRed THEN
  49.             PSET (x + 70, y - 10), &HFFFFFF00
  50.         ELSEIF vRed THEN
  51.             PSET (x + 70, y - 10), &HFFFF0000
  52.         END IF
  53.     NEXT
  54.  
  55.  
  56.  

EDIT: Update with combined codes
« Last Edit: February 21, 2020, 01:57:58 pm by bplus »

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: how to - x axis?
« Reply #29 on: February 21, 2020, 01:38:37 pm »
Code: [Select]
deflng a-z
const sw = 640
const sh = 480
screen _newimage(sw, sh, 32)

w = 400
h = 400
dim a as double, b as double
a = 0.08
b = 0.03

line (0,0)-(sw,sh),_rgb(237,221,255),bf
for y=0 to h
for x=0 to w
if (sqr((x + a*w)^2 + (y - h/2)^2) > (w/2 + b*w)) and (sqr((x - w - a*w)^2 + (y - h/2)^2) > (w/2 + b*w)) or (sqr((y + a*h)^2 + (x - w/2)^2) > (h/2 + b*h)) and (sqr((y - h - a*h)^2 + (x - w/2)^2) > (h/2 + b*h))then pset (sw/2 - w/2 + x, sh/2 + h/2 - y),_rgb(187,0,0)
next
next

sleep
system

Holy shiznit!
In order to understand recursion, one must first understand recursion.