Author Topic: 3D Land Grid  (Read 2926 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
3D Land Grid
« on: May 17, 2020, 07:43:32 pm »
Finally, I've made a 3D land grid that lets you move forward, back, and side to side, that WORKS! LOL I been wanting to make this since the 90's or possibly the 80's but could never figure it out. LOL
I've been close sooo many times lol. 
I know it doesn't have turning or jumping (or flying), but I'm not at that level of math. So feel free to do what you wish with it. Use the arrow keys to move forward, back, left side, right side. And press the space bar to stop. I might make this into a game in the future.

Code: QB64: [Select]
  1. 'This is SierraKen's first 3D Land Grid Example.
  2. 'Use the arrow keys to move and press space bar to stop.
  3. 'Made on May 17, 2020.
  4.  
  5. SCREEN _NEWIMAGE(800, 600, 32)
  6. xs = 10
  7. GOSUB grid:
  8.  
  9.  
  10.     _LIMIT 100
  11.     a$ = INKEY$
  12.     IF a$ = CHR$(0) + CHR$(72) THEN d = 1
  13.     IF a$ = CHR$(0) + CHR$(80) THEN d = 2
  14.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3
  15.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4
  16.     IF a$ = " " THEN d = 0
  17.     if a$ = CHR$(27) THEN END
  18.     IF d = 1 THEN speed = speed + 1
  19.     IF d = 2 THEN speed = speed - 1
  20.     IF d = 3 THEN v = v - 1
  21.     IF d = 4 THEN v = v + 1
  22.     GOSUB grid:
  23.  
  24.  
  25. grid:
  26. 'Left vertical lines.
  27. FOR x = 395 TO 0 STEP -xs - xx
  28.     xx = xx + 5
  29.     IF v > 7 THEN v = -7
  30.     IF v < -7 THEN v = 7
  31.     LINE (x + v, 300)-(x - xx + v, 600), _RGB32(255, 255, 255)
  32.  
  33. 'Right vertical lines.
  34. FOR x = 405 TO 800 STEP xs + xx2
  35.     xx2 = xx2 + 5
  36.     IF v > 7 THEN v = -7
  37.     IF v < -7 THEN v = 7
  38.     LINE (x + v, 300)-(x + xx2 + v, 600), _RGB32(255, 255, 255)
  39.  
  40. 'Horizontal lines.
  41. LINE (0, 300)-(800, 300), _RGB32(255, 255, 255)
  42. FOR hy = 305 TO 600 STEP xs + xx3
  43.     xx3 = xx3 + 5
  44.     IF speed > 7 THEN speed = -7
  45.     IF speed < -7 THEN speed = 7
  46.     LINE (0, hy + xx3 + speed)-(800, hy + xx3 + speed), _RGB32(255, 255, 255)
  47. NEXT hy
  48. xx = 0: xx2 = 0: xx3 = 0
  49.  
  50.  
Ken's Land Grid.jpg
* Ken's Land Grid.jpg (Filesize: 488.32 KB, Dimensions: 1915x1036, Views: 355)
« Last Edit: May 17, 2020, 08:58:15 pm by SierraKen »

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: 3D Land Grid
« Reply #1 on: May 18, 2020, 02:58:15 am »
Nice! It really creates 3D Illusion
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Land Grid
« Reply #2 on: May 18, 2020, 12:47:46 pm »
Thanks Ashish. :)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Land Grid
« Reply #3 on: May 18, 2020, 03:36:46 pm »
Today I added the ability to turn. It doesn't tilt like a plane, but it turns to around a 45 degree turn on the grid. I also added some color to make it look better. I also added an updated picture to this post.

Code: QB64: [Select]
  1. 'This is SierraKen's first 3D Land Grid Example.
  2. 'Use the arrow keys to move and turn and press space bar to stop.
  3. 'Made on May 18, 2020.
  4. 'V. 0.2
  5.  
  6. SCREEN _NEWIMAGE(800, 600, 32)
  7. xs = 10
  8. GOSUB grid:
  9.  
  10.  
  11.     _LIMIT 100
  12.     a$ = INKEY$
  13.     IF a$ = CHR$(0) + CHR$(72) THEN d = 1
  14.     IF a$ = CHR$(0) + CHR$(80) THEN d = 2
  15.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3
  16.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4
  17.     IF a$ = " " THEN d = 0
  18.     IF a$ = CHR$(27) THEN END
  19.     IF d = 1 THEN speed = speed + 1
  20.     IF d = 2 THEN speed = speed - 1
  21.     IF d = 3 AND speed > 0 THEN
  22.         v = v - 1
  23.         vv = vv - 2
  24.         speed = speed + 2
  25.     END IF
  26.     IF d = 4 AND speed > 0 THEN
  27.         v = v + 1
  28.         vv = vv + 2
  29.         speed = speed + 2
  30.     END IF
  31.     IF d = 3 AND speed <= 0 THEN
  32.         v = v - 1
  33.         vv = vv - 2
  34.         speed = speed - 2
  35.     END IF
  36.     IF d = 4 AND speed <= 0 THEN
  37.         v = v + 1
  38.         vv = vv + 2
  39.         speed = speed - 2
  40.     END IF
  41.     GOSUB grid:
  42.  
  43. grid:
  44. PAINT (2, 2), _RGB32(0, 0, 150)
  45. LINE (0, 300)-(800, 600), _RGB32(0, 155, 0), BF
  46. 'Left vertical lines.
  47. FOR x = 395 TO -300 STEP -xs - xx
  48.     xx = xx + 5
  49.     IF v > 7 THEN v = -7
  50.     IF v < -7 THEN v = 7
  51.     IF vv > 300 THEN vv = 300
  52.     IF vv < -300 THEN vv = -300
  53.     LINE (x + v - vv, 300)-(x - xx + v + vv, 600), _RGB32(255, 255, 255)
  54.  
  55. 'Right vertical lines.
  56. FOR x = 405 TO 1100 STEP xs + xx2
  57.     xx2 = xx2 + 5
  58.     IF v > 7 THEN v = -7
  59.     IF v < -7 THEN v = 7
  60.     IF vv > 300 THEN vv = 300
  61.     IF vv < -300 THEN vv = -300
  62.     LINE (x + v - vv, 300)-(x + xx2 + v + vv, 600), _RGB32(255, 255, 255)
  63.  
  64. 'Horizontal lines.
  65. LINE (0, 300)-(800, 300), _RGB32(127, 172, 255)
  66. FOR hy = 305 TO 600 STEP xs + xx3
  67.     xx3 = xx3 + 5
  68.     IF speed > 7 THEN speed = -7
  69.     IF speed < -7 THEN speed = 7
  70.     LINE (0, hy + xx3 + speed)-(800, hy + xx3 + speed), _RGB32(255, 255, 255)
  71. NEXT hy
  72.  
  73. xx = 0: xx2 = 0: xx3 = 0
  74.  
  75.  
  76.  
Ken's Land Grid 2.jpg
* Ken's Land Grid 2.jpg (Filesize: 353.34 KB, Dimensions: 808x636, Views: 288)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Land Grid
« Reply #4 on: May 19, 2020, 04:04:15 pm »
I just added curved turns, both forward and backward. That way you don't stop on a dime every time you turn. :)

Here is the update:

Code: QB64: [Select]
  1. 'This is SierraKen's first 3D Land Grid Example.
  2. 'Use the arrow keys to move and turn and press space bar to stop.
  3. 'Made on May 19, 2020.
  4. 'V. 0.3 - Added curved turns both forward and backward.
  5.  
  6. SCREEN _NEWIMAGE(800, 600, 32)
  7. xs = 10
  8. GOSUB grid:
  9.  
  10.  
  11.     _LIMIT 100
  12.     a$ = INKEY$
  13.     IF a$ = CHR$(0) + CHR$(72) THEN d = 1
  14.     IF a$ = CHR$(0) + CHR$(80) THEN d = 2
  15.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3
  16.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4
  17.     IF a$ = " " THEN d = 0
  18.     IF a$ = CHR$(27) THEN END
  19.     IF d = 1 THEN speed = speed + 1: b = 0
  20.     IF d = 2 THEN speed = speed - 1: b = 1
  21.     IF d = 3 AND speed > 0 THEN
  22.         v = v - 1
  23.         vv = vv - 2
  24.     END IF
  25.     IF d = 4 AND speed > 0 THEN
  26.         v = v + 1
  27.         vv = vv + 2
  28.     END IF
  29.     IF d = 3 AND speed <= 0 THEN
  30.         v = v - 1
  31.         vv = vv - 2
  32.     END IF
  33.     IF d = 4 AND speed <= 0 THEN
  34.         v = v + 1
  35.         vv = vv + 2
  36.     END IF
  37.     IF (d = 3 OR d = 4) AND b = 0 THEN speed = speed + 1
  38.     IF (d = 3 OR d = 4) AND b = 1 THEN speed = speed - 1
  39.     GOSUB grid:
  40.  
  41. grid:
  42. PAINT (2, 2), _RGB32(0, 0, 150)
  43. LINE (0, 300)-(800, 600), _RGB32(0, 155, 0), BF
  44. 'Left vertical lines.
  45. FOR x = 395 TO -300 STEP -xs - xx
  46.     xx = xx + 5
  47.     IF v > 7 THEN v = -7
  48.     IF v < -7 THEN v = 7
  49.     IF vv > 300 THEN vv = 300
  50.     IF vv < -300 THEN vv = -300
  51.     LINE (x + v - vv, 300)-(x - xx + v + vv, 600), _RGB32(255, 255, 255)
  52.  
  53. 'Right vertical lines.
  54. FOR x = 405 TO 1100 STEP xs + xx2
  55.     xx2 = xx2 + 5
  56.     IF v > 7 THEN v = -7
  57.     IF v < -7 THEN v = 7
  58.     IF vv > 300 THEN vv = 300
  59.     IF vv < -300 THEN vv = -300
  60.     LINE (x + v - vv, 300)-(x + xx2 + v + vv, 600), _RGB32(255, 255, 255)
  61.  
  62. 'Horizontal lines.
  63. LINE (0, 300)-(800, 300), _RGB32(127, 172, 255)
  64. FOR hy = 305 TO 600 STEP xs + xx3
  65.     xx3 = xx3 + 5
  66.     IF speed > 7 THEN speed = -7
  67.     IF speed < -7 THEN speed = 7
  68.     LINE (0, hy + xx3 + speed)-(800, hy + xx3 + speed), _RGB32(255, 255, 255)
  69. NEXT hy
  70.  
  71. xx = 0: xx2 = 0: xx3 = 0
  72.  
  73.  
  74.  

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: 3D Land Grid
« Reply #5 on: May 19, 2020, 06:10:26 pm »
That's a nice grid effect that inspired me to tackle a grid I've always wanted to do, hex grid. Mine doesn't move, ...yet ....I'm thinkin' about it. ;)

Code: QB64: [Select]
  1. 'Hex grid
  2. SCREEN _NEWIMAGE(480, 640, 32)
  3. s = 35
  4. sb = s / 2
  5. ho = s + (s * COS(_D2R(60)))
  6. vo = 2 * (s * SIN(_D2R(60)))
  7. FOR x = 0 TO 9
  8.     FOR y = 0 TO 11
  9.         IF x MOD 2 = 0 THEN b = vo / 2 ELSE b = 0
  10.         LINE (x * ho - sb, y * vo + b)-(x * ho + s - sb, y * vo + b)
  11.         LINE (x * ho + s - sb, y * vo + b)-(x * ho + s + ho - s - sb, y * vo + b - (vo / 2))
  12.         LINE (x * ho + s - sb, y * vo + b)-(x * ho + s + ho - s - sb, y * vo + b + (vo / 2))
  13.     NEXT y
  14.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Land Grid
« Reply #6 on: May 19, 2020, 06:45:28 pm »
Thanks OldMoses! Wow yours is pretty cool! Hexagonal Grid is what a lot of games used to use or just a way to print out maps for games.
I'm not sure where I am going with mine, I don't have a plan yet. I might make a giant map using a data file or DATA lines using something with coordinates and plotting in shapes and maybe some simple designs. Not sure if am able to do it but I might look into it soon. If I can't do that, I can always make no map and just use random shapes that appear. So we'll see. :)
« Last Edit: May 19, 2020, 06:48:34 pm by SierraKen »

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: 3D Land Grid
« Reply #7 on: May 19, 2020, 07:40:44 pm »
Hmmm... it turned out not too difficult to get it moving after all. If I could run a two dimensional array along with it, it might make a half assed game. Maybe some dude running along dodging boulders or something...

Code: QB64: [Select]
  1. 'Moving hex grid
  2. SCREEN _NEWIMAGE(480, 640, 32)
  3. s = 35
  4. sb = s / 2
  5. ho = s + (s * COS(_D2R(60)))
  6. vo = 2 * (s * SIN(_D2R(60)))
  7.     CLS
  8.     k = k + 1
  9.     IF k MOD vo = 0 THEN k = 0
  10.     FOR x = 0 TO 9
  11.         FOR y = -1 TO 11
  12.             IF x MOD 2 = 0 THEN b = vo / 2 ELSE b = 0
  13.             LINE (x * ho - sb, y * vo + b + k)-(x * ho + s - sb, y * vo + b + k)
  14.             LINE (x * ho + s - sb, y * vo + b + k)-(x * ho + s + ho - s - sb, y * vo + b - (vo / 2) + k)
  15.             LINE (x * ho + s - sb, y * vo + b + k)-(x * ho + s + ho - s - sb, y * vo + b + (vo / 2) + k)
  16.         NEXT y
  17.     NEXT x
  18.     _LIMIT 100
  19.     _DISPLAY

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Land Grid
« Reply #8 on: May 19, 2020, 09:00:49 pm »
That came out great! Your overhead view would be pretty fun. Just add a character in the center. :)
With my 3D perspective I have to make every object start out small and get larger as they approach. It shouldn't be too hard from what I have now. Of course my grid that I have now is only for looks, it won't have anything to do with coordinates, etc.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: 3D Land Grid
« Reply #9 on: May 19, 2020, 11:51:36 pm »
Hmmm... it turned out not too difficult to get it moving after all. If I could run a two dimensional array along with it, it might make a half assed game. Maybe some dude running along dodging boulders or something...

I've converted your program into a 3D projection, hope you like it ;-)

Code: QB64: [Select]
  1. 'Moving hex grid
  2. SCREEN _NEWIMAGE(480, 480, 32)
  3. s = 35
  4. sb = s / 2
  5. ho = s + (s * COS(_D2R(60)))
  6. vo = 2 * (s * SIN(_D2R(60)))
  7.  
  8. ymax = 20
  9.     CLS
  10.     k = k - 1
  11.     IF k MOD vo = 0 THEN k = 0
  12.     FOR x = -10 TO 10
  13.         FOR y = 0 TO ymax
  14.             IF x MOD 2 = 0 THEN b = vo / 2 ELSE b = 0
  15.             x11 = x * ho - sb
  16.             y11 = y * vo + b + k
  17.             x12 = x * ho + s - sb
  18.             y12 = y * vo + b + k
  19.             p1 = 240 + x11 * 700 / (y11 + 250)
  20.             q1 = 200 * 700 / (y11 + 250)
  21.             p2 = 240 + x12 * 700 / (y12 + 250)
  22.             q2 = 200 * 700 / (y12 + 250)
  23.             'LINE (x11, y11)-(x12, y12)
  24.             LINE (p1, q1)-(p2, q2)
  25.  
  26.             x21 = x * ho + s - sb
  27.             y21 = y * vo + b + k
  28.             x22 = x * ho + s + ho - s - sb
  29.             y22 = y * vo + b - (vo / 2) + k
  30.             p1 = 240 + x21 * 700 / (y21 + 250)
  31.             q1 = 200 * 700 / (y21 + 250)
  32.             p2 = 240 + x22 * 700 / (y22 + 250)
  33.             q2 = 200 * 700 / (y22 + 250)
  34.             'LINE (x21, y21)-(x22, y22)
  35.             LINE (p1, q1)-(p2, q2)
  36.  
  37.             x31 = x * ho + s - sb
  38.             y31 = y * vo + b + k
  39.             x32 = x * ho + s + ho - s - sb
  40.             y32 = y * vo + b + (vo / 2) + k
  41.             p1 = 240 + x31 * 700 / (y31 + 250)
  42.             q1 = 200 * 700 / (y31 + 250)
  43.             p2 = 240 + x32 * 700 / (y32 + 250)
  44.             q2 = 200 * 700 / (y32 + 250)
  45.             'LINE (x31, y31)-(x32, y32)
  46.             LINE (p1, q1)-(p2, q2)
  47.         NEXT y
  48.     NEXT x
  49.  
  50.     LINE (0, 0)-(480, 100), _RGB(0, 0, 0), BF
  51.     LINE (0, 101)-(480, 101)
  52.     _LIMIT 50
  53.     _DISPLAY
  54.  
  55.  
  56.  
« Last Edit: May 19, 2020, 11:59:29 pm by _vince »

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: 3D Land Grid
« Reply #10 on: May 20, 2020, 12:03:18 am »
That's incredible, Vince.

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: 3D Land Grid
« Reply #11 on: May 20, 2020, 12:14:11 am »
@vince Amazing! Can you also fill the color in the hexagon tile?
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 3D Land Grid
« Reply #12 on: May 20, 2020, 12:57:54 pm »
These are great! 

- Dav

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Land Grid
« Reply #13 on: May 21, 2020, 12:31:07 am »
I just added flying! Whew, it's harder than I thought, spent all day and evening on it.
Use the + and - keys for the accelerator. Use the down arrow to go up and up arrow to go down (like a plane has). Use the right and left arrows to turn.
Please tell me what you think of it. Comments are often inspirational to keep me programming. :)

Code: QB64: [Select]
  1. 'Flying - By SierraKen
  2. 'Made on May 20, 2020.
  3. 'V. 0.4 - Added Flying
  4.  
  5. SCREEN _NEWIMAGE(800, 600, 32)
  6. xs = 10
  7. GOSUB grid:
  8.  
  9. e = 100
  10. _TITLE "Down arrow goes up. Up arrow goes down. + and - number pad keys are the accelerator. Left and Right keys turn."
  11.     _LIMIT 1000
  12.     a$ = INKEY$
  13.  
  14.     IF a$ = CHR$(0) + CHR$(72) THEN d = 6: e = e + .5: b = 0 'Up arrow key flies down.
  15.     IF a$ = CHR$(0) + CHR$(80) THEN d = 5: e = e - .5: b = 0 'Down arrow key flies up.
  16.     IF a$ = "+" THEN d = 1: speed2 = speed2 + 10
  17.     IF a$ = "-" THEN
  18.         speed2 = speed2 - 10
  19.         IF speed2 < 0 THEN speed = speed - 2: b = 1
  20.     END IF
  21.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3 'Right
  22.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4 'Left
  23.     IF a$ = " " THEN d = 0
  24.     IF a$ = CHR$(27) THEN END
  25.     IF d = 1 THEN speed = speed + 4: b = 0
  26.     IF d = 3 AND speed > 0 THEN
  27.         v = v - 1
  28.         vv = vv - 2
  29.         tilt = tilt - 2
  30.         speed = speed + 4
  31.     END IF
  32.     IF d = 4 AND speed > 0 THEN
  33.         v = v + 1
  34.         vv = vv + 2
  35.         tilt = tilt + 2
  36.         speed = speed + 4
  37.     END IF
  38.     IF d = 3 AND speed <= 0 THEN
  39.         v = v - 1
  40.         vv = vv - 2
  41.         tilt = tilt - 2
  42.         speed = speed + 4
  43.     END IF
  44.     IF d = 4 AND speed <= 0 THEN
  45.         v = v + 1
  46.         vv = vv + 2
  47.         tilt = tilt + 2
  48.         speed = speed + 4
  49.     END IF
  50.     IF d = 5 THEN speed = speed + 4: b = 0
  51.     IF d = 6 THEN speed = speed + 4: b = 0
  52.  
  53.     IF tilt > 200 THEN tilt = 200
  54.     IF tilt < -200 THEN tilt = -200
  55.     IF (d = 3 OR d = 4 OR d = 5 OR d = 6) AND b = 0 THEN speed = speed + 1
  56.     IF (d = 3 OR d = 4) AND b = 1 THEN speed = speed - 1
  57.     IF e > 100 THEN e = 100
  58.     IF e < 0 THEN e = 0
  59.     elevation = e - 100
  60.     elevation = -elevation
  61.     elevation = elevation * 100
  62.     GOSUB grid:
  63.     IF speed2 < 0 THEN speed2 = 0
  64.     IF speed2 > 2000 THEN speed2 = 2000
  65.     delay = 2 / speed2
  66.     IF delay < .002 THEN delay = .002
  67.     IF delay > .02 THEN delay = .02
  68.     _DELAY delay
  69.  
  70.  
  71. grid:
  72. LINE (0, 299 - e - tilt)-(800, 299 - e + tilt), _RGB32(0, 0, 150)
  73. PAINT (400, 2), _RGB32(0, 0, 150)
  74. LINE (0, 300 - e - tilt)-(800, 300 - e + tilt), _RGB32(0, 155, 0)
  75. PAINT (400, 599), _RGB32(0, 155, 0)
  76.  
  77. LOCATE 1, 1: PRINT elevation
  78. LOCATE 2, 1: PRINT speed2
  79. 'Left vertical lines.
  80. FOR x = 395 - e TO -300 STEP -xs - xx - e
  81.     xx = xx + 5
  82.     IF v > 7 + e THEN v = -7
  83.     IF v < -7 THEN v = 7 + e
  84.     IF vv > 300 THEN vv = 300
  85.     IF vv < -300 THEN vv = -300
  86.     FOR findy = 0 TO 600
  87.         IF POINT(x + v - vv, findy) = _RGB32(0, 155, 0) THEN yy = findy: GOTO nex:
  88.     NEXT findy
  89.     nex:
  90.     IF POINT(x - xx + v + vv, 600) = _RGB32(0, 0, 150) OR POINT(x + v - vv, yy) = _RGB32(0, 0, 150) THEN GOTO skip:
  91.     LINE (x + v - vv, yy)-(x - xx + v + vv, 600), _RGB32(255, 255, 255)
  92.     skip:
  93.  
  94. 'Right vertical lines.
  95. FOR x = 405 + e TO 1100 STEP xs + xx2 + e
  96.     xx2 = xx2 + 5
  97.     IF v > 7 + e THEN v = -7
  98.     IF v < -7 THEN v = 7 + e
  99.     IF vv > 300 THEN vv = 300
  100.     IF vv < -300 THEN vv = -300
  101.     FOR findy = 0 TO 600
  102.         IF POINT(x + v - vv, findy) = _RGB32(0, 155, 0) THEN yy2 = findy: GOTO nex2:
  103.     NEXT findy
  104.     nex2:
  105.     IF POINT(x - xx2 + v + vv, 600) = _RGB32(0, 0, 150) OR POINT(x + v - vv, yy2) = _RGB32(0, 0, 150) THEN GOTO skip2:
  106.     LINE (x + v - vv, yy2)-(x + xx2 + v + vv, 600), _RGB32(255, 255, 255)
  107.     skip2:
  108.  
  109. 'Horizontal lines.
  110. FOR hy = 0 TO 600 STEP xs + xx3 + e
  111.     xx3 = xx3 + 5
  112.     IF speed > 7 + e THEN speed = -7
  113.     IF speed < -7 THEN speed = 7 + e
  114.     FOR findx = 0 TO 800
  115.         IF POINT(findx, hy + xx3 + speed) = _RGB32(0, 155, 0) THEN
  116.             xx4 = findx
  117.         END IF
  118.     NEXT findx
  119.     FOR findx2 = 0 TO 800
  120.         IF POINT(findx2, hy + xx3 + speed) = _RGB32(0, 155, 0) THEN
  121.             xx5 = findx2
  122.             LINE (xx4, hy + xx3 + speed)-(xx5, hy + xx3 + speed), _RGB32(255, 255, 255)
  123.             GOTO nex3:
  124.         END IF
  125.     NEXT findx2
  126.     nex3:
  127. NEXT hy
  128. xx = 0: xx2 = 0: xx3 = 0
  129.  
« Last Edit: May 21, 2020, 04:19:29 pm by SierraKen »

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: 3D Land Grid
« Reply #14 on: May 21, 2020, 08:20:27 am »
use pseudo 3d relief qb64 my milli program:

https://www.qb64.org/forum/index.php?topic=702.msg103948#msg103948

 
reliefqb.gif
« Last Edit: May 21, 2020, 08:21:39 am by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself