Author Topic: 3D Tunnel Lines Demonstration  (Read 9076 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
3D Tunnel Lines Demonstration
« on: July 11, 2019, 01:33:07 pm »
This is about as good as I can do regarding 3D stuff. Although I could use the same type of thing for land I guess.
Use the up and down arrow keys to move forward and back. I will probably turn this into a game at some point. :)
Feel free to use it in your own stuff if you wish. I sure like the SCREEN _NEWIMAGE command's ability to change window sizes, makes things
like this so much easier.

(Code deleted to make it look a bit better, look at next post.)
« Last Edit: July 11, 2019, 04:15:42 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #1 on: July 11, 2019, 04:16:11 pm »
I added 1 more square and made it look a bit better.

(Code deleted again, now it looks EXTREMELY better! Scroll down this forum thread to get the updated version, which includes the little monster sprite.)
« Last Edit: July 12, 2019, 03:04:34 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #2 on: July 11, 2019, 05:33:30 pm »
I added a little sprite monster that pops up every so often and then disappears as you move. :) This is the start of a little dungeon game I'm making. Comments are welcome of course.

(Code deleted again, now it looks EXTREMELY better! Scroll down this forum thread to get the updated version.)
« Last Edit: July 12, 2019, 03:03:54 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #3 on: July 12, 2019, 01:32:28 am »
Here is my 3D Tunnel pointed with mouse:
Code: QB64: [Select]
  1. _TITLE "tunnel" ' B+ 2019-01-04
  2. CONST xmax = 800
  3. CONST ymax = 600
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5.     CLS
  6.     mx = _MOUSEX: my = _MOUSEY
  7.     drx = mx / 50: dlx = (xmax - mx) / 50: dty = my / 50: dby = (ymax - my) / 50: i = 0
  8.     x = mx: y = my
  9.     FOR i = 50 TO 1 STEP -1
  10.         LINE (mx - i * drx, my - i * dty)-(mx + i * dlx, my + i * dby), _RGB32(4 * i, 2 * i, 1 * i), BF
  11.     NEXT
  12.     _DISPLAY
  13.     _LIMIT 60
  14.  
  15.  

To it, I added squared coil and trans-sender (lightning) between inner most point and outer most:
Code: QB64: [Select]
  1. _TITLE "tunnel coil 3 with transcender" ' B+ 2019-01-08
  2. CONST xmax = 800
  3. CONST ymax = 600
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5.     CLS
  6.     mx = _MOUSEX: my = _MOUSEY
  7.     dlx = (mx - 1) / 50: drx = (xmax - mx - 1) / 50: dty = (my - 1) / 50: dby = (ymax - my - 1) / 50
  8.     x = mx: y = my
  9.     tx = 0: ty = 0 '<<<<<<<<<<<<<<<< need this to work???
  10.     FOR i = 50 TO 1 STEP -1
  11.         LINE (mx - i * dlx, my - i * dty)-(mx + i * drx, my + i * dby), _RGB32(2 * i, 3 * i, 4 * i), BF
  12.     NEXT
  13.     COLOR _RGBA32(255, 140, 140, 120)
  14.     x = xmax - mx: y = ymax - my
  15.     PSET (x, y)
  16.     tx = 0: ty = 0
  17.     WHILE ty < ymax
  18.         tx = tx + drx
  19.         LINE -STEP(-tx, 0)
  20.         ty = ty + dby
  21.         LINE -STEP(0, -ty)
  22.         tx = tx + dlx
  23.         LINE -STEP(tx, 0)
  24.         ty = ty + dty
  25.         LINE -STEP(0, ty)
  26.     WEND
  27.     Lightning mx, my, xmax - mx, ymax - my, ymax
  28.     _DISPLAY
  29.     _LIMIT 60
  30.  
  31. SUB Lightning (x1, y1, x2, y2, d)
  32.     IF d < 5 THEN
  33.         COLOR _RGB(225, 225, 245)
  34.         LINE (x1, y1)-(x2, y2)
  35.     ELSE
  36.         mx = (x2 + x1) / 2
  37.         my = (y2 + y1) / 2
  38.         mx = mx + -.5 * RND * d * .4 * rand&&(-2, 2)
  39.         my = my + -.5 * RND * d * .4 * rand&&(-2, 2)
  40.         Lightning x1, y1, mx, my, d / 2
  41.         Lightning x2, y2, mx, my, d / 2
  42.     END IF
  43.  
  44. FUNCTION rand&& (lo&&, hi&&)
  45.     rand&& = INT(RND * (hi&& - lo&& + 1)) + lo&&
  46.  
  47.  

Then I loaded a bunch of them onto a satellite (Stars.png attached):
Code: QB64: [Select]
  1. _TITLE "Move your mouse" + SPACE$(53) + "Satellite" 'B+ post 2019-01-10
  2.  
  3. CONST xmax = 600
  4. CONST ymax = 600
  5. SCREEN _NEWIMAGE(xmax, ymax, 32)
  6. _SCREENMOVE 300, 60
  7. map& = _NEWIMAGE(xmax, ymax, 32)
  8. stars& = _LOADIMAGE("stars.png")
  9. r = ymax / 2.5: xc = xmax / 2: yc = ymax / 2: xo = 0
  10.  
  11.     mx = _MOUSEX / xmax: my = _MOUSEY / ymax
  12.     _DEST map&
  13.     COLOR , _RGB32(68, 68, 68): CLS
  14.     FOR y = 0 TO ymax STEP 100
  15.         FOR x = 0 TO xmax STEP 100
  16.             tct x + 3, y + 3, 94, 94, mx, my
  17.         NEXT
  18.     NEXT
  19.     _PUTIMAGE , stars&, 0
  20.     FOR y = -r TO r
  21.         x1 = SQR(r * r - y * y)
  22.         tv = (_ASIN(y / r) + 1.5) / 3
  23.         FOR x = -x1 + 1 TO x1
  24.             tu = (_ASIN(x / x1) + 1.5) / 6
  25.             _SOURCE map&
  26.             pc~& = POINT((xo + tu * xmax) MOD xmax, tv * ymax)
  27.             _DEST 0
  28.             PSET (x + xc, y + yc), pc~&
  29.         NEXT x
  30.     NEXT y
  31.     xo = xo - 1 + xmax
  32.     xo = xo MOD xmax
  33.     _DISPLAY
  34.     _LIMIT 10
  35.  
  36. SUB tct (x, y, w, h, fx, fy)
  37.     mx = fx * w
  38.     my = fy * h
  39.     dlx = (mx - 1) / 10: drx = (w - mx - 1) / 10: dty = (my - 1) / 10: dby = (h - my - 1) / 10
  40.     tx = 0: ty = 0
  41.     FOR i = 10 TO 1 STEP -1
  42.         LINE (x + mx - i * dlx, y + my - i * dty)-(x + mx + i * drx, y + my + i * dby), _RGB32(5 * i, 10 * i, 15 * i), BF
  43.     NEXT
  44.     COLOR _RGBA32(155, 140, 40, 120)
  45.     xx = x + w - mx: yy = y + h - my
  46.     PSET (xx, yy)
  47.     tx = 0: ty = 0
  48.     WHILE tx < w - drx - dlx
  49.         tx = tx + drx
  50.         LINE -STEP(-tx, 0)
  51.         ty = ty + dby
  52.         LINE -STEP(0, -ty)
  53.         tx = tx + dlx
  54.         LINE -STEP(tx, 0)
  55.         ty = ty + dty
  56.         LINE -STEP(0, ty)
  57.     WEND
  58.     Lightning x + mx, y + my, xx, yy, h
  59.  
  60. SUB Lightning (x1, y1, x2, y2, d)
  61.     IF d < 5 THEN
  62.         COLOR _RGB(225, 225, 245)
  63.         LINE (x1, y1)-(x2, y2)
  64.     ELSE
  65.         mx = (x2 + x1) / 2
  66.         my = (y2 + y1) / 2
  67.         mx = mx + -.5 * RND * d * .4 * rand&&(-2, 2)
  68.         my = my + -.5 * RND * d * .4 * rand&&(-2, 2)
  69.         Lightning x1, y1, mx, my, d / 2
  70.         Lightning x2, y2, mx, my, d / 2
  71.     END IF
  72.  
  73. FUNCTION rand&& (lo&&, hi&&)
  74.     rand&& = INT(RND * (hi&& - lo&& + 1)) + lo&&
  75.  
  76.  

Look what it did to my TV:
Code: QB64: [Select]
  1. _TITLE "TV Static test, press esc to quit!"
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3.  
  4. TVimage& = _SCREENIMAGE
  5. TVSCR& = _NEWIMAGE(500, 300, 32)
  6. _PUTIMAGE , TVimage&, TVSCR&
  7. 'DIM m AS _MEM
  8. 'm = _MEMIMAGE(TVSCR&)
  9. _FREEIMAGE TVimage&
  10. eff = 1
  11.  
  12. 'WHILE 1 'to make static move around put it in endless loop
  13. 'cheap way to draw box
  14. FOR w = 50 TO 1 STEP -1 '.25
  15.     LINE (100 - w, 100 - w)-(700 - 2 * w, 550 - 2 * w), _RGB32(124 - w, 62 - .5 * w, 31 - .25 * w), B
  16. LINE (100, 100)-(700, 550), _RGB32(124, 62, 31), BF
  17.  
  18. 'some knobs
  19. FOR r = 20 TO 1 STEP -.5
  20.     CIRCLE (200, 500), r, _RGB(255 - r * 12, 255 - r * 12, 255 - r * 12)
  21.     CIRCLE (600, 500), r, _RGB(255 - r * 12, 255 - r * 12, 255 - r * 12)
  22. FOR r = 4 TO 1 STEP -.1
  23.     CIRCLE (200 + r, 500 + r), 8 - .5 * r, _RGB(0, 0, 0)
  24.     CIRCLE (600 + r, 500 + r), 8 - .5 * r, _RGB(0, 0, 0)
  25.     CIRCLE (300 + r, 500 + r), 8 - .5 * r, _RGB(0, 0, 0)
  26.     CIRCLE (400 + r, 500 + r), 8 - .5 * r, _RGB(0, 0, 0)
  27.     CIRCLE (500 + r, 500 + r), 8 - .5 * r, _RGB(0, 0, 0)
  28. 'WEND
  29.  
  30.     'picture "tube"
  31.     FOR y = 150 TO 450 '                                           y range of box
  32.         FOR x = 150 TO 650 '                                       x range of box
  33.             '   _RGB32(red, green, blue) sets color in this graphics screen mode
  34.             'B&W static   make R, G, B all same number for a shade of gray
  35.  
  36.             much = 250
  37.             position = position + 1: IF position > 300 * 500 THEN position = 150 * 150
  38.             k& = _KEYHIT
  39.             IF k& = 27 THEN END '                             escape was pressed to quit
  40.             IF k& = 32 THEN eff = eff + 1: IF eff > 10 THEN eff = 1
  41.             IF position MOD eff = 0 THEN clr& = _RGB32(RND * 255, RND * 255, RND * 255) ELSE _SOURCE TVSCR&: clr& = POINT(x - 150, y - 150): _SOURCE 0
  42.             PSET (x, y), clr&
  43.         NEXT
  44.     NEXT
  45.     '    LINE (150, 150)-(650, 150 + 250 * RND), _RGB32(255, 255, 255), BF 'roll screen a bit
  46.     _DISPLAY 'keep flashing from drawing down to minimum
  47. 'WEND
  48.  
  49.  

PS when trying to watch TV, press space bar.

Fun stuff! :D Carry on...
stars.png
* stars.png (Filesize: 716.48 KB, Dimensions: 800x600, Views: 264)
« Last Edit: July 12, 2019, 01:52:06 am by bplus »

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #4 on: July 12, 2019, 08:30:13 am »
Hi. Good job Bplus and Ken. I enjoyed the TV one program
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 Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #5 on: July 12, 2019, 10:30:29 am »
Nice thread. I like all in this thread.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #6 on: July 12, 2019, 10:37:52 am »
Yes Petr, I am sure you contributed to that TV code, the sound and screen image/bad picture... :)

Remove comment on line 49 of TV for a rolling picture effect.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #7 on: July 12, 2019, 11:38:20 am »
Really? Nice :-D

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #8 on: July 12, 2019, 01:04:08 pm »
Awesome programs B+! I checked them all out. Your first one blew me away on the detail of the tunnel. I might learn a bit from that. The hardest thing on my tunnel was the illusion of moving through the tunnel using the arrow keys. You aren't exactly moving down the tunnel, the squares move about 50 coordinates then switch back to the next one, making the illusion. I tried to add paint and also a door on the side but it's too hard for me to figure out. But I might make mine a bit different with maybe many more squares, not sure yet. Thanks also to the others in here that liked my little 1980's looking tunnel. hehe :) I might also just keep it the way it is and add more monsters and gold and stuff. lol

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #9 on: July 12, 2019, 02:26:19 pm »
Reminds me of the TV I grew up watching... Only mine had bigger knobs!

Hey Mark, maybe you could incorporate my "pattern" challenge: https://www.qb64.org/forum/index.php?topic=1494.msg106908#msg106908

LOL - That was a fun run!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #10 on: July 12, 2019, 02:56:03 pm »
Awesome programs B+! I checked them all out. Your first one blew me away on the detail of the tunnel. I might learn a bit from that. The hardest thing on my tunnel was the illusion of moving through the tunnel using the arrow keys. You aren't exactly moving down the tunnel, the squares move about 50 coordinates then switch back to the next one, making the illusion. I tried to add paint and also a door on the side but it's too hard for me to figure out. But I might make mine a bit different with maybe many more squares, not sure yet. Thanks also to the others in here that liked my little 1980's looking tunnel. hehe :) I might also just keep it the way it is and add more monsters and gold and stuff. lol

Hi Ken,

I didn't even know your tunnel moved until the demon arrived, by then I realized there must be more to first 2 posts. You might mention in introduction of code... it probably is why I pulled out that old code, to show how a tunnel is done. :-))

The moving tunnel is a nice effect, I wonder if it can be done without all the line statements? (I will test.) The effect is definitely a keeper! Yes, racer games are built on such... instead of walls, landscape is moving...


Hi Pete,

Yes, your test pattern would work nicely with TV rolling image, a QB64 screen not bad though considering not having to store or attach image.

I was wondering when I would see a comment about the knobs :D

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #11 on: July 12, 2019, 03:02:29 pm »
Here is a MUCH better tunnel example. I realized after looking at B+'s code that all I needed was a loop to make it look much better. I also changed the square movement dynamics to be a REAL movement instead of an illusion. B+ I'm sorry you are also working on this, I should have been more precise in my wording on what I was going to do next. I did put a thank you in the code to you for your example. I also added instructions on the _TITLE so people can see it better. Your examples really helped me. Here is the updated version:
Code: QB64: [Select]
  1. 'Made by Ken G. on July 11, 2019
  2. 'Thank you to B+ for his example on QB64.org forum!
  3.  
  4. _TITLE "Ken's Tunnel - Use Up and Down Arrow Keys"
  5. SCREEN _NEWIMAGE(600, 600, 32)
  6. x = 300: y = 300: t = 50
  7. s = 10
  8. sz2 = 10
  9. FOR sz = s TO 300
  10.     LINE (x - sz, y - sz)-(x + sz, y + sz), _RGB32(0, sz / 2, 0), B
  11. NEXT sz
  12.  
  13. go:
  14. _LIMIT 1000
  15. a$ = INKEY$
  16. IF a$ = CHR$(27) THEN END
  17. IF a$ = CHR$(0) + CHR$(72) THEN
  18.     os = s
  19.     s = s + 5
  20.     IF s < 10 THEN s = 300
  21.     IF s > 300 THEN s = 10
  22.     t = t + 10
  23.     IF t > 255 THEN t = 20
  24.     LINE (x - os, y - os)-(x + os, y + os), _RGB32(0, sz2 / 2, 0), B
  25.     sz2 = sz2 + 5
  26.     IF sz2 < 10 THEN sz2 = 300
  27.     IF sz2 > 300 THEN sz2 = 10
  28.     LINE (x - s, y - s)-(x + s, y + s), _RGB32(0, t * 2, 0), B
  29.  
  30.     IF m = 0 THEN
  31.         RANDOMIZE TIMER
  32.         monster = INT(RND * 500) + 1
  33.         IF monster > 498 THEN
  34.             m = 1
  35.             GOSUB monster:
  36.         END IF
  37.     END IF
  38.     IF m = 1 THEN
  39.         mon = mon + 1
  40.         IF mon > 50 THEN
  41.             LINE (290, 284)-(316, 316), _RGB32(0, 0, 0), BF
  42.             m = 0
  43.             mon = 0
  44.         END IF
  45.     END IF
  46. IF a$ = CHR$(0) + CHR$(80) THEN
  47.     os = s
  48.     s = s - 5
  49.     IF s < 10 THEN s = 300
  50.     IF s > 300 THEN s = 10
  51.     t = t + 10
  52.     IF t > 255 THEN t = 20
  53.     LINE (x - os, y - os)-(x + os, y + os), _RGB32(0, sz2 / 2, 0), B
  54.     sz2 = sz2 - 5
  55.     IF sz2 < 10 THEN sz2 = 300
  56.     IF sz2 > 300 THEN sz2 = 10
  57.     LINE (x - s, y - s)-(x + s, y + s), _RGB32(0, t * 2, 0), B
  58.     IF m = 0 THEN
  59.         RANDOMIZE TIMER
  60.         monster = INT(RND * 500) + 1
  61.         IF monster > 498 THEN
  62.             m = 1
  63.             GOSUB monster:
  64.         END IF
  65.     END IF
  66.     IF m = 1 THEN
  67.         mon = mon + 1
  68.         IF mon > 50 THEN
  69.             LINE (290, 284)-(316, 316), _RGB32(0, 0, 0), BF
  70.             m = 0
  71.             mon = 0
  72.         END IF
  73.     END IF
  74. GOTO go:
  75.  
  76. monster:
  77. RESTORE monsterdata:
  78. FOR my = 1 TO 13
  79.     FOR mx = 1 TO 13
  80.         READ cl
  81.         PSET (mx + 290, my + 290), _RGB32(0, cl * 100, 0)
  82.     NEXT mx
  83. NEXT my
  84.  
  85. monsterdata:
  86. DATA 0,0,0,0,4,4,4,4,4,0,0,0,0
  87. DATA 0,0,0,4,0,0,0,0,0,4,0,0,0
  88. DATA 0,0,4,0,0,0,0,0,0,0,4,0,0
  89. DATA 0,4,0,5,5,0,0,5,5,0,0,4,0
  90. DATA 4,0,0,5,5,0,0,5,5,0,0,0,4
  91. DATA 4,0,0,0,0,0,0,0,0,0,0,0,4
  92. DATA 4,0,0,0,0,4,4,0,0,0,0,0,4
  93. DATA 4,0,0,0,0,4,4,0,0,0,0,0,4
  94. DATA 0,4,0,0,0,0,0,0,0,0,0,4,0
  95. DATA 0,0,4,0,4,4,4,4,0,0,4,0,0
  96. DATA 0,0,4,0,4,4,4,4,0,0,4,0,0
  97. DATA 0,0,4,0,0,0,0,0,0,0,4,0,0
  98. DATA 0,0,4,4,4,4,4,4,4,4,4,0,0
  99.  
  100.  
« Last Edit: July 12, 2019, 03:06:59 pm by SierraKen »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #12 on: July 12, 2019, 06:01:09 pm »
You'll probably be asked to reove the code for sake of copyright infringement. Sure, you say it's a tunnel, but to me it looks a lot like the old X-box logo!

Hi Mark. Yes. TV was better in the old days, when you could grab both knobs and find what you were looking for. Today, we're stuck in our easy chairs holding our own remotes. That's not progress, that's just pathetic.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #13 on: July 12, 2019, 07:06:20 pm »
Hi Ken,

Try this:
Code: QB64: [Select]
  1. 'Made by Ken G. on July 11, 2019
  2. 'Thank you to B+ for his example on QB64.org forum!
  3.  
  4. _TITLE "Ken's Tunnel - Use Up and Down Arrow Keys" 'mod B+ 2019-07-12
  5. SCREEN _NEWIMAGE(600, 600, 32)
  6. DIM offset, my, mx, cl, s, sz, a$, monster, ms
  7.  
  8. offset = 600000 'track if we are coming or going
  9. DIM SHARED m(1 TO 13, 1 TO 13) AS _UNSIGNED LONG 'monster color storage
  10. FOR my = 1 TO 13 'load monster color array
  11.     FOR mx = 1 TO 13
  12.         READ cl
  13.         m(mx, my) = _RGB32(cl * 60, 0, 0)
  14.     NEXT mx
  15. NEXT my
  16.  
  17. DO 'go: << DO... LOOP indents main loop and makes it easier to read  
  18.     CLS
  19.  
  20.     'handle tunnel
  21.     offset = offset + s
  22.     IF offset = 0 THEN offset = 300000
  23.     IF offset = 600001 THEN offset = 300000
  24.     FOR sz = 0 TO 300
  25.         IF (sz + offset) MOD 40 THEN
  26.             LINE (300 - sz, 300 - sz)-(300 + sz, 300 + sz), _RGB32(0, sz / 2, 0), B
  27.         ELSE
  28.             LINE (300 - sz, 300 - sz)-(300 + sz, 300 + sz), _RGB32(255 * sz / 300, 255 * sz / 300, 255 * sz / 300), B
  29.         END IF
  30.     NEXT sz
  31.  
  32.     'handle keys
  33.     a$ = INKEY$
  34.     IF a$ = CHR$(27) THEN END
  35.     IF a$ = CHR$(0) + CHR$(72) THEN s = s - 1: IF s < -5 THEN s = -5
  36.     IF a$ = CHR$(0) + CHR$(80) THEN s = s + 1: IF s > 5 THEN s = 5
  37.  
  38.     'handle monster
  39.     monster = monster - 1
  40.     IF s > 0 THEN ms = ms - .01
  41.     IF s < 0 THEN ms = ms + .01
  42.     IF ms > 5 THEN ms = 5
  43.     IF ms < 0 THEN ms = 0
  44.     IF monster <= 0 THEN monster = RND * 500 ELSE GOSUB showMonster
  45.  
  46.     _DISPLAY
  47.     _LIMIT 60
  48. LOOP 'goto go
  49.  
  50. showMonster:
  51. FOR my = 1 TO 13
  52.     FOR mx = 1 TO 13
  53.         IF s > 0 THEN
  54.             LINE (mx * ms + 270, my * ms + 270)-STEP(ms, ms), m(mx, my), BF
  55.         ELSE
  56.             LINE (mx * ms + 270, my * ms + 270)-STEP(ms, ms), m(mx, my), BF
  57.         END IF
  58.     NEXT
  59.  
  60. monsterdata:
  61. DATA 0,0,0,4,4,4,4,4,4,4,0,0,0
  62. DATA 0,0,4,4,4,4,4,4,4,4,4,0,0
  63. DATA 0,4,4,4,4,4,4,4,4,4,4,0,0
  64. DATA 0,4,4,4,4,4,4,4,4,4,4,0,0
  65. DATA 4,4,4,1,1,4,4,1,1,4,4,4,0
  66. DATA 4,4,4,4,4,4,4,4,4,4,4,4,0
  67. DATA 4,4,4,4,4,4,1,4,4,4,4,4,0
  68. DATA 4,4,4,4,4,1,1,4,4,4,4,4,0
  69. DATA 0,4,4,4,4,4,4,4,4,4,0,0,0
  70. DATA 0,0,4,4,1,1,1,1,4,4,0,0,0
  71. DATA 0,0,4,4,4,4,4,4,4,4,0,0,0
  72. DATA 0,0,4,4,4,4,4,4,4,4,0,0,0
  73. DATA 0,0,4,4,4,4,4,4,4,0,0,0,0
  74.  

EDIT:  made monster size, ms, work better.
EDIT2: more comments and monster face lift
« Last Edit: July 12, 2019, 07:54:59 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 3D Tunnel Lines Demonstration
« Reply #14 on: July 12, 2019, 09:55:45 pm »
That's really amazing B+.... am a bit shocked how much you guys know. For example, I should learn what MOD means and what offset does. It might take awhile for me to make a game out of this, if I do make one. This Summer Heat is really slowing down my programming about half as much as it was a few weeks ago. But I still want to keep going. :))) Thank you!