QB64.org Forum

Active Forums => Programs => Topic started by: SierraKen on June 30, 2019, 08:45:22 pm

Title: Tank Walls
Post by: SierraKen on June 30, 2019, 08:45:22 pm
Hi all. You might have guessed it, but I decided to make a game out of my graphical plotting program and wall detection example. It took me a few days to make this. I got the idea mostly from the old Atari 2600 game COMBAT from the 1980's. But this time your tank is smaller, will lesser sounds. But the awesome thing is, you get to make your own map layout of walls before you start playing. You will need both programs to make your own and play the game, but I will try to include an example layout picture on this forum thread as well as the game. The object of the game is to shoot him with your blue tank. You use the arrow keys and press the space bar to shoot. I apologize if you run into problems, I've had to do quite a number of fixes on it the last few days but I hope to have them all fixed. It's not a perfect game in that you will see some extra graphics here and there that don't belong there anymore, such as your shot from your cannon and a leftover dot of the tank you shot. You also will see holes in the walls if you shoot the tank near a wall, but I left that there for the looks of destruction. lol Please tell me what you think. If you can make it better, then that is great! Do anything you wish to it for yourself. But I doubt I will do much more if anything, I rattled my brain for days over this, as you can see in all the code lol. But have fun! :) I'll add it to my website soon. *Note: You can also re-direct your tank shot, after you have shot, using your arrow keys, like a guided missile. :)

Here is the graphical plotting program first again, so you have that to make your own layouts. The game asks you for the name of your graphical creation when you start. I'll add the game itself on the 3rd post. The next post will have an example picture layout to use with it if you wish.

Code: QB64: [Select]
  1. 'This plotter was made in 2 days by Ken G. and finished on June 27, 2019 using QB64 language.
  2. 'Thank you for some ideas from some people at the QB64.org Forum!
  3. 'Code to use the pictures made with this can be found marked out toward the end of this program.
  4. 'This program is Freeware and will always be Freeware.
  5. 'Feel free to use any of this code in your own programs.
  6. '-----------------------------------------------------------------------------------------------
  7. _TITLE "Ken's Plotter"
  8. _LIMIT 400
  9. start:
  10. DIM x$(10000), y$(10000), x(10000), y(10000)
  11. p = 0
  12. t = 0
  13. pn = 0
  14. e = 0
  15. SCREEN _NEWIMAGE(640, 480, 32)
  16. PRINT "                     Ken's Plotter"
  17. PRINT "                       By Ken G."
  18. PRINT "Use the arrow keys to move the red box."
  19. PRINT "Use Space Bar to move Pen Down to draw and Pen Up to just move."
  20. PRINT "Use E to turn the Eraser off and on."
  21. PRINT "Use Esc to start over."
  22. PRINT "**** You will need to have Pen Down to use Eraser."
  23. PRINT "There is a 10,000 plot limit. Don't worry about this limit"
  24. PRINT "because you can fill the entire screen and more and still be"
  25. PRINT "less than 10,000 plots."
  26. PRINT "Press S to save and L to load an already saved picture."
  27. PRINT "The saved .txt file will have X,Y plots on each line that"
  28. PRINT "can be used in your own programs."
  29. PRINT "This is a simple plotting/drawing program that doesn't change colors."
  30. PRINT "The saved files don't have any colors on them, so when"
  31. PRINT "you use them for your own programs, you will need to add a color."
  32. PRINT "The window scale is 640 x 480 pixels with each plot every 10 pixels."
  33. PRINT "So when using in your own programs, make sure and make X = X + 10 and"
  34. PRINT "Y = Y + 10 to display with LINE command."
  35. PRINT "Code to load your picture is marked out in the code of this program."
  36. PRINT "The coordinates and Pen Up, Pen Down, Eraser On, Eraser Off will be"
  37. PRINT "in the top Window title bar."
  38. INPUT "Press enter to start.", st$
  39. x = 320: y = 240
  40. FOR gridx = 0 TO 640 STEP 10
  41.     FOR gridy = 0 TO 480 STEP 10
  42.         LINE (gridx, gridy)-(gridx + 10, gridy + 10), _RGB32(255, 255, 255), B
  43.     NEXT gridy
  44. NEXT gridx
  45. LINE (x, y)-(x + 10, y + 10), _RGB(255, 0, 0), B
  46. pen$ = "Up": eraser$ = "Off"
  47. xx$ = STR$(x): yy$ = STR$(y)
  48. titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  49. _TITLE titl$
  50. go:
  51. _LIMIT 400
  52. a$ = INKEY$
  53. IF a$ = CHR$(27) THEN GOTO start:
  54. IF a$ = "s" OR a$ = "S" THEN GOTO save:
  55. IF a$ = "l" OR a$ = "L" OR a$ = "m" OR a$ = "M" THEN GOTO load:
  56. IF a$ = CHR$(0) + CHR$(72) THEN
  57.     LINE (x, y)-(x + 10, y + 10), _RGB(255, 255, 255), B
  58.     y = y - 10
  59.     IF y < 0 THEN y = 0
  60.     LINE (x, y)-(x + 10, y + 10), _RGB(255, 0, 0), B
  61.     IF pn = 1 THEN
  62.         x2 = x + 10
  63.         y2 = y + 10
  64.         IF e = 0 THEN LINE (x, y)-(x2, y2), _RGB32(255, 255, 255), BF
  65.         t = t + 1
  66.         x$(t) = STR$(x): y$(t) = STR$(y)
  67.         IF e = 1 THEN
  68.             LINE (x, y)-(x2, y2), _RGB32(0, 0, 0), BF
  69.             GOSUB eraser:
  70.         END IF
  71.         GOSUB check:
  72.     END IF
  73.     xx$ = STR$(x): yy$ = STR$(y)
  74.     titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  75.     _TITLE titl$
  76. IF a$ = CHR$(0) + CHR$(80) THEN
  77.     LINE (x, y)-(x + 10, y + 10), _RGB(255, 255, 255), B
  78.     y = y + 10
  79.     IF y > 470 THEN y = 470
  80.     LINE (x, y)-(x + 10, y + 10), _RGB(255, 0, 0), B
  81.     IF pn = 1 THEN
  82.         x2 = x + 10
  83.         y2 = y + 10
  84.         LINE (x, y)-(x2, y2), _RGB32(255, 255, 255), BF
  85.         t = t + 1
  86.         x$(t) = STR$(x): y$(t) = STR$(y)
  87.         IF e = 1 THEN
  88.             LINE (x, y)-(x2, y2), _RGB32(0, 0, 0), BF
  89.             GOSUB eraser:
  90.         END IF
  91.         GOSUB check:
  92.     END IF
  93.     xx$ = STR$(x): yy$ = STR$(y)
  94.     titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  95.     _TITLE titl$
  96. IF a$ = CHR$(0) + CHR$(77) THEN
  97.     LINE (x, y)-(x + 10, y + 10), _RGB(255, 255, 255), B
  98.     x = x + 10
  99.     IF x > 630 THEN x = 630
  100.     LINE (x, y)-(x + 10, y + 10), _RGB(255, 0, 0), B
  101.     IF pn = 1 THEN
  102.         x2 = x + 10
  103.         y2 = y + 10
  104.         LINE (x, y)-(x2, y2), _RGB32(255, 255, 255), BF
  105.         t = t + 1
  106.         x$(t) = STR$(x): y$(t) = STR$(y)
  107.         IF e = 1 THEN
  108.             LINE (x, y)-(x2, y2), _RGB32(0, 0, 0), BF
  109.             GOSUB eraser:
  110.         END IF
  111.         GOSUB check:
  112.     END IF
  113.     xx$ = STR$(x): yy$ = STR$(y)
  114.     titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  115.     _TITLE titl$
  116. IF a$ = CHR$(0) + CHR$(75) THEN
  117.     LINE (x, y)-(x + 10, y + 10), _RGB(255, 255, 255), B
  118.     x = x - 10
  119.     IF x < 0 THEN x = 0
  120.     LINE (x, y)-(x + 10, y + 10), _RGB(255, 0, 0), B
  121.     IF pn = 1 THEN
  122.         x2 = x + 10
  123.         y2 = y + 10
  124.         LINE (x, y)-(x2, y2), _RGB32(255, 255, 255), BF
  125.         t = t + 1
  126.         x$(t) = STR$(x): y$(t) = STR$(y)
  127.         IF e = 1 THEN
  128.             LINE (x, y)-(x2, y2), _RGB32(0, 0, 0), BF
  129.             GOSUB eraser:
  130.         END IF
  131.         GOSUB check:
  132.     END IF
  133.     xx$ = STR$(x): yy$ = STR$(y)
  134.     titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  135.     _TITLE titl$
  136. IF a$ = "e" OR a$ = "E" THEN
  137.     e = e + 1
  138.     IF e = 2 THEN e = 0
  139.     IF e = 1 THEN
  140.         IF pen$ = "Down" THEN eraser$ = "On"
  141.         titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  142.         _TITLE titl$
  143.     END IF
  144.     IF e = 0 THEN
  145.         eraser$ = "Off"
  146.         titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  147.         _TITLE titl$
  148.     END IF
  149. IF a$ = " " THEN
  150.     pn = pn + 1
  151.     IF pn = 2 THEN pn = 0
  152. IF pn = 1 THEN
  153.     pen$ = "Down"
  154.     titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  155.     _TITLE titl$
  156.  
  157. IF pn = 0 THEN
  158.     pen$ = "Up"
  159.     titl$ = "Ken's Plotter X=" + xx$ + " Y=" + yy$ + "     Pen: " + pen$ + "     Eraser: " + eraser$
  160.     _TITLE titl$
  161. GOTO go:
  162.  
  163. save:
  164. save2:
  165. INPUT "Type file name of maze to create (without the .txt ending):", nm$
  166. nm$ = nm$ + ".txt"
  167. 'Checking to see if the file already exists on your computer.
  168. theFileExists = _FILEEXISTS(nm$)
  169. IF theFileExists = -1 THEN
  170.     PRINT "File Already Exists"
  171.     PRINT "Saving will delete your old maze."
  172.     PRINT
  173.     PRINT "Would you like to still do it?"
  174.     PRINT "(Y/N). Esc ends program."
  175.     llloop:
  176.     _LIMIT 10
  177.     ag2$ = INKEY$
  178.     IF ag2$ = "" THEN GOTO llloop:
  179.     IF ag2$ = "y" OR ag$ = "Y" THEN GOTO save3:
  180.     IF ag2$ = CHR$(27) THEN END
  181.     GOTO save2:
  182. save3:
  183. OPEN nm$ FOR OUTPUT AS #1
  184. FOR plots = 1 TO t
  185.     _LIMIT 400
  186.     IF x$(plots) = "" OR y$(plots) = "" THEN GOTO skip2:
  187.     PRINT #1, x$(plots); ","; y$(plots)
  188.     skip2:
  189. NEXT plots
  190. PRINT nm$; " has been saved to your computer."
  191. INPUT "Press enter to start again."; a$
  192. GOTO start:
  193.  
  194. '------------------------------------------------------------------------------
  195. 'The following is the code you can use to load the graphic to your own program.
  196. '------------------------------------------------------------------------------
  197.  
  198. load:
  199. INPUT "Type file name to load (without the .txt ending):", nm$
  200. nm$ = nm$ + ".txt"
  201. OPEN nm$ FOR INPUT AS #1
  202. ggo:
  203. _LIMIT 400
  204. p = p + 1
  205. INPUT #1, x$(p), y$(p)
  206. x(p) = VAL(x$(p)): y(p) = VAL(y$(p))
  207. LINE (x(p), y(p))-(x(p) + 10, y(p) + 10), _RGB(255, 255, 255), BF
  208. IF EOF(1) THEN CLOSE #1: GOTO done:
  209. GOTO ggo:
  210. done:
  211. a$ = INKEY$
  212. IF a$ = "" THEN GOTO done:
  213. IF a$ = CHR$(27) THEN END
  214.  
  215. '------------------------------------------------------------------------------
  216.  
  217. GOTO start:
  218.  
  219. check:
  220. IF t = 10000 THEN
  221.     INPUT "Limit has been reached, do you want to save (Yes/No):"; yn$
  222.     IF yn$ = "YES" OR yn$ = "yes" OR yn$ = "Yes" OR yn$ = "YEs" OR yn$ = "yES" OR yn$ = "Y" OR yn$ = "y" THEN GOTO save:
  223.     GOTO start:
  224.  
  225. eraser:
  226. FOR ee = 1 TO t
  227.     IF x$(ee) = x$(t) AND y$(ee) = y$(t) THEN
  228.         x$(ee) = "": y$(ee) = ""
  229.     END IF
  230. NEXT ee
  231.  

 



Title: Re: Tank Walls
Post by: SierraKen on June 30, 2019, 08:49:02 pm
Here is an attachment file of a pretty simple but neat graphical layout for Tank Walls. You can try this before making your own if you wish. Put this "halls.txt" file in the same directory as the game. I'll put the game on the next post. Just remember, you need a graphic, like this one, to be used with the Tank Walls game.

Title: Re: Tank Walls
Post by: SierraKen on June 30, 2019, 08:51:49 pm
And here is the Tank Walls game itself :). Please don't be picky on it, I just started on QB64 and still not as good as you guys yet I bet, although I used to program a lot decades ago. But I've wanted to make a game like this ever since the 80's. :)

(Code deleted from this post, a better version is below on this same thread.)
Title: Re: Tank Walls
Post by: johnno56 on June 30, 2019, 11:26:38 pm
Cool game... Sneaky little mongrel that enemy tank... I managed to blow him away more time than he did me.... Nicely done!
Title: Re: Tank Walls
Post by: SierraKen on June 30, 2019, 11:40:13 pm
Thanks Johno! Am glad you like it. Will be interesting to see how it works with different maps. And of course anyone can change the input command asking people for a map, to just plugging a map or more directly to the code.
Title: Re: Tank Walls
Post by: bplus on June 30, 2019, 11:42:44 pm
Dang Ken you whipped up 500+ lines of code into a working game in a day or two?!?!

When the little red monster learns to quit banging it's turret against the first wall it runs into, I am going to be in deep doo-doo! ;-))
Title: Re: Tank Walls
Post by: SierraKen on July 01, 2019, 12:12:03 am
LOL B+, yeah I can't figure out how to make much more intelligence than what he has. He will catch you if you are in the same hallway or room though, if you don't shoot him first. :) Glad you like it. Oh, it took almost a week. :) I'll put it on my website now.  http://ken.x10host.com/qb64/
Title: Re: Tank Walls
Post by: bplus on July 01, 2019, 11:03:12 am
Hi Ken,

I am feeling ambiguous about making the enemy smarter, but if the little red devil can remember it has been in same place 2 steps ago, it might turn 90 degrees and try another banger session of only once, turn 90 again... it must then find it's way out of 3 sided trap without need of detecting it's prey in the vicinity to give chase. Keep a memory of last 3 steps, if 1st = 3rd then turn.
Title: Re: Tank Walls
Post by: SierraKen on July 01, 2019, 12:18:56 pm
B+ yes I've thought of that kind of stuff, but the problem is, it can change direction, but it will automatically fall back to the same thing just about, over and over. Because it is always looking for where you are too. I also thought about making it only half the time looking for where you are, but then it would be too easy when you are in the same room or hallway. Maybe I can make loop variables that expand out until they hit the next wall in 4 directions from the enemy and if it doesn't see you, then it won't look for you. Hmm I'll give it a try I think. Not sure yet how I can do this but I'll look.
Title: Re: Tank Walls
Post by: bplus on July 01, 2019, 12:26:26 pm
Yeah, you'll get it soon enough :D

and then I will have to find another game easy to win ;-))
Title: Re: Tank Walls
Post by: SierraKen on July 01, 2019, 12:46:19 pm
LOL it was easier than I thought! I just made it so when the enemy tank hits a wall, it picks a random direction and goes another way. It wasn't like I thought, he doesn't keep falling back to the wall all the time. But when he does, he keeps randomly picking a different direction until he doesn't hit the wall and then goes and goes. :))) This is SO AWESOME! Thanks for the suggestion.
Here is the updated version:

(Code deleted again, even better version below.)
Title: Re: Tank Walls
Post by: bplus on July 01, 2019, 01:30:08 pm
I was think'in it could just check if a wall was where it was intending to step... easy too.
Title: Re: Tank Walls
Post by: SierraKen on July 01, 2019, 02:35:37 pm
Well, I found ways to get rid of almost all the leftover graphics clutter. Except for a tiny bit which I'm just going to leave. Here is the better version:

(Code deleted again, I apologize. The updated code, with a limit on the shots, is on page 2 of this forum thread.)
Title: Re: Tank Walls
Post by: SierraKen on July 01, 2019, 04:36:20 pm
Here is a second map I've made if anyone is interested. I have both now on my website as well.
Title: Re: Tank Walls
Post by: johnno56 on July 01, 2019, 05:52:00 pm
In reference to wall collision. Bplus has a good idea to check to see if a wall exists in the direction of movement. I used to get "stuck" in walls as well. Using bplus's idea of detection, when you hit the wall, simply 'bounce' back at the same velocity as the collision. Voila! No more partial 'Caspers'. Just a thought...
Title: Re: Tank Walls
Post by: johnno56 on July 01, 2019, 05:59:01 pm
Just tried your new level...  Wow that enemy has some serious speed.... Cool...
Title: Re: Tank Walls
Post by: SierraKen on July 01, 2019, 07:34:35 pm
Thanks Johno. Yeah I'm pretty much done making this game. I did kinda make a bounce-back system but instead of moving him back, I just changed his direction. This way he doesn't always come back to the same location all the time toward where I am on the entire map. Thanks for the suggestion though. But I think I'm finished, for now anyway. :)
Title: Re: Tank Walls
Post by: bplus on July 01, 2019, 11:12:23 pm
In reference to wall collision. Bplus has a good idea to check to see if a wall exists in the direction of movement. I used to get "stuck" in walls as well. Using bplus's idea of detection, when you hit the wall, simply 'bounce' back at the same velocity as the collision. Voila! No more partial 'Caspers'. Just a thought...

Ha! Actually I think it smarter to check if wall is there before going in that direction.
Title: Re: Tank Walls
Post by: johnno56 on July 01, 2019, 11:42:22 pm
That's what I meant by, "to check to see if a wall exists 'in the direction' of movement". My fault for not expressing the idea in a clear and concise method.

Oh. Just thought of a slight modification Correct me if I am wrong, but as the game stands, when a tank is destroyed the player and enemy are randomly placed within the scene and the 'dance' continues. How about making it a little harder to play with each victory?  What about setting the players 'shooting range" slightly shorter with each win or perhaps multiple hits on the enemy to destroy it? Just some thoughts... Then there are 'power ups'... Speed. Firing distance. Invulnerability. Casper (move through walls)... But only have them appear for a short time... Sometimes, and that's pretty rare, I think of weird stuff like that... lol
Title: Re: Tank Walls
Post by: SierraKen on July 02, 2019, 01:18:52 pm
Johno, that's a good idea about limiting the shot range. I never thought of that. Because as it is now, if someone knows how to control the shot by using your arrow keys really well, the person will win every time. I'll check that out and see what I can do. Thanks! The other stuff, maybe someday :). Someday I also might make a package of like 20 maps and make it go from 1 to the other after a certain amount of points are reached. After like 20 maps the game is over, or it's like Pac-Man and goes back to the first but a lot faster. lol Great ideas.
Title: Re: Tank Walls
Post by: SierraKen on July 02, 2019, 03:46:29 pm
OK here we go, I made the shots go almost the length of the width of the window. This still lets people control the direction of the shot with the arrow keys but not too much.
I also spruced up the program a bit more and fixed a couple variables and deleted 2 variables not needed. I also sectioned off the enemy tank as the last half of the program completely and your tank as the first half of the program. So here it is :) Have fun!

Code: QB64: [Select]
  1. 'This game has been made from my Walls Detector Example program.
  2. 'You are the blue tank and you move with the arrow keys and shoot the red tank with the space bar.
  3. 'You can control the direction of your shot by using the arrow keys as it flies.
  4. 'But first you have to make a walls layout picture using my 'Ken's Plotter' program which can be found on my website here: http://ken.x10host.com/qb64/
  5. 'Which is very simple, you just plot using the arrow keys and space bar. All instructions are on that program.
  6. 'Make many layout pictures and have a BLAST!
  7. 'I call the enemy a 'monster' in my code because at first this was going to be just shooting monsters but it turned out to be more like tanks.
  8. 'This game was made on June 30, 2019 by Ken G.
  9. 'Feel free to edit this code how you wish but do not sell it. This game took a couple weeks to make both programs and is something I've wanted to make for a very long time.
  10.  
  11. start:
  12. 'You will need to DIM these strings and variables first to make memory.
  13. DIM x$(10000), y$(10000), x(10000), y(10000)
  14. _TITLE "Tank Walls     Score: 0     Lives: 5"
  15. points = 0
  16. lives = 5
  17. mshot = 0
  18. shot = 0
  19. ds = 1
  20. dd = 1
  21. sht = 0
  22. sht2 = 0
  23. 'xx and yy are the coordinates to your blue tank and others are the turrent locations of the tank.
  24. xx = 320: yy = 240
  25. leftxt = xx - 4: leftyt = yy + 2: leftxxt = xx: leftyyt = yy + 3
  26. rightxt = xx + 5: rightyt = yy + 2: rightxxt = xx + 9: rightyyt = yy + 3
  27. upxt = xx + 2: upyt = yy - 4: upxxt = xx + 3: upyyt = yy
  28. downxt = xx + 2: downyt = yy + 5: downxxt = xx + 3: downyyt = yy + 9
  29. GOSUB oldtank:
  30. _SCREENMOVE 300, 200
  31. SCREEN _NEWIMAGE(640, 480, 32)
  32. PRINT "                     Tank Walls"
  33. PRINT "                     By Ken G."
  34. PRINT "This is an example game on how to use any picture you make"
  35. PRINT "to turn into a game that shoots a computer tank."
  36. PRINT "First you need to create a picture or maze using 'Ken's Plotter'."
  37. PRINT "Make many layout pictures to use with this game and have a BLAST!"
  38. PRINT "Use your arrow keys to move the little blue square tank around and it will"
  39. PRINT "stop at every wall. You start out in the very center"
  40. PRINT "of the window. The enemy tank is the red square and it will be"
  41. PRINT "randomly placed within the walls."
  42. PRINT "When you are in line with the green square tank,"
  43. PRINT "press the Space Bar to fire a shot at him."
  44. PRINT "Notice how your shot stops at every wall it hits and if you hit"
  45. PRINT "the enemy, it will make a small explosion."
  46. PRINT "You start off with 5 lives, when all 5 are gone, the game is over."
  47. PRINT "You get 10 points for every Enemy Tank you hit."
  48. PRINT "You can control the direction of your shot by using the arrow"
  49. PRINT "keys as it flies."
  50. again:
  51. INPUT "Type file name of picture to load (without the .txt ending):", nm$
  52. IF nm$ = "" THEN GOTO again:
  53. nm$ = nm$ + ".txt"
  54. theFileExists = _FILEEXISTS(nm$)
  55. IF theFileExists = 0 THEN
  56.     PRINT "File does not exist, try again."
  57.     GOTO again:
  58. 'First you load the picture and put every coordinate into memory.
  59. OPEN nm$ FOR INPUT AS #1
  60. ggo:
  61. _LIMIT 1000
  62. p = p + 1
  63. INPUT #1, x$(p), y$(p)
  64. x(p) = VAL(x$(p)): y(p) = VAL(y$(p))
  65. LINE (x(p), y(p))-(x(p) + 10, y(p) + 10), _RGB32(255, 255, 255), BF
  66.     CLOSE #1
  67.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(127, 127, 255), BF
  68.     LINE (upxt, upyt)-(upxxt, upyyt), _RGB32(127, 127, 255), BF
  69.     'Start monster location
  70.     place:
  71.     xxx = INT(RND * 630) + 5
  72.     yyy = INT(RND * 470) + 5
  73.     IF xxx - xx < 150 AND xxx - xx > -150 THEN
  74.         IF yyy - yy < 150 AND yyy - yy > -150 THEN
  75.             GOTO place:
  76.         END IF
  77.     END IF
  78.     FOR tt = 1 TO p
  79.         IF xxx > x(tt) - 15 AND xxx < x(tt) + 15 AND yyy > y(tt) - 15 AND yyy < y(tt) + 15 THEN GOTO place:
  80.     NEXT tt
  81.     LINE (xxx, yyy)-(xxx + 5, yyy + 5), _RGB32(255, 0, 0), BF
  82.     leftxt2 = xxx - 4: leftyt2 = yyy + 2: leftxxt2 = xxx: leftyyt2 = yyy + 3
  83.     rightxt2 = xxx + 5: rightyt2 = yyy + 2: rightxxt2 = xxx + 9: rightyyt2 = yyy + 3
  84.     upxt2 = xxx + 2: upyt2 = yyy - 4: upxxt2 = xxx + 3: upyyt2 = yyy
  85.     downxt2 = xxx + 2: downyt2 = yyy + 5: downxxt2 = xxx + 3: downyyt2 = yyy + 9
  86.     ds = 2
  87.     LINE (downxt2, downyt2)-(downxxt2, downyyt2), _RGB32(255, 0, 0), BF
  88.     GOTO go:
  89. GOTO ggo:
  90.  
  91. 'Here is the main loop of the program where you move the square around.
  92. go:
  93. _LIMIT 100
  94. a$ = INKEY$
  95. IF a$ = CHR$(27) THEN END
  96. IF a$ = " " GOTO shoot:
  97. IF a$ = CHR$(0) + CHR$(72) THEN
  98.     ds = 1
  99.     GOSUB oldtank:
  100.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(0, 0, 0), BF
  101.     GOSUB oldtank2:
  102.     yy = yy - 5
  103.     GOSUB check:
  104.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(127, 127, 255), BF
  105.     upxt = xx + 2: upyt = yy - 4: upxxt = xx + 3: upyyt = yy
  106.     LINE (upxt, upyt)-(upxxt, upyyt), _RGB32(127, 127, 255), BF
  107.  
  108. IF a$ = CHR$(0) + CHR$(80) THEN
  109.     ds = 2
  110.     GOSUB oldtank:
  111.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(0, 0, 0), BF
  112.     GOSUB oldtank2:
  113.     yy = yy + 5
  114.     GOSUB check:
  115.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(127, 127, 255), BF
  116.     downxt = xx + 2: downyt = yy + 5: downxxt = xx + 3: downyyt = yy + 9
  117.     LINE (downxt, downyt)-(downxxt, downyyt), _RGB32(127, 127, 255), BF
  118.  
  119. IF a$ = CHR$(0) + CHR$(75) THEN
  120.     ds = 3
  121.     GOSUB oldtank:
  122.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(0, 0, 0), BF
  123.     GOSUB oldtank2:
  124.     xx = xx - 5
  125.     GOSUB check:
  126.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(127, 127, 255), BF
  127.     leftxt = xx - 4: leftyt = yy + 2: leftxxt = xx: leftyyt = yy + 3
  128.     LINE (leftxt, leftyt)-(leftxxt, leftyyt), _RGB32(127, 127, 255), BF
  129.  
  130. IF a$ = CHR$(0) + CHR$(77) THEN
  131.     ds = 4
  132.     GOSUB oldtank:
  133.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(0, 0, 0), BF
  134.     GOSUB oldtank2:
  135.     xx = xx + 5
  136.     GOSUB check:
  137.     LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(127, 127, 255), BF
  138.     rightxt = xx + 5: rightyt = yy + 2: rightxxt = xx + 9: rightyyt = yy + 3
  139.     LINE (rightxt, rightyt)-(rightxxt, rightyyt), _RGB32(127, 127, 255), BF
  140. IF shot = 1 AND ds = 1 THEN GOTO shoot1:
  141. IF shot = 1 AND ds = 2 THEN GOTO shoot2:
  142. IF shot = 1 AND ds = 3 THEN GOTO shoot3:
  143. IF shot = 1 AND ds = 4 THEN GOTO shoot4:
  144. GOTO monster:
  145.  
  146. 'Here is where the computer checks to see if your tank hits a wall.
  147. check:
  148. IF yy < 0 THEN yy = 0
  149. IF xx < 0 THEN xx = 0
  150. IF yy > 475 THEN yy = 475
  151. IF xx > 635 THEN xx = 635
  152.  
  153. FOR t = 1 TO p
  154.     IF xx > x(t) - 10 AND xx < x(t) + 15 AND yy > y(t) - 10 AND yy < y(t) + 15 THEN xx = oldxx: yy = oldyy
  155.  
  156. oldtank:
  157. oldyy = yy
  158. oldxx = xx
  159. oldleftxt = leftxt: oldleftyt = leftyt: oldleftxxt = leftxxt: oldleftyyt = leftyyt
  160. oldrightxt = rightxt: oldrightyt = rightyt: oldrightxxt = rightxxt: oldrightyyt = rightyyt
  161. oldupxt = upxt: oldupyt = upyt: oldupxxt = upxxt: oldupyyt = upyyt
  162. olddownxt = downxt: olddownyt = downyt: olddownxxt = downxxt: olddownyyt = downyyt
  163.  
  164. oldtank2:
  165. LINE (oldleftxt, oldleftyt)-(oldleftxxt, oldleftyyt), _RGB32(0, 0, 0), BF
  166. LINE (oldrightxt, oldrightyt)-(oldrightxxt, oldrightyyt), _RGB32(0, 0, 0), BF
  167. LINE (oldupxt, oldupyt)-(oldupxxt, oldupyyt), _RGB(0, 0, 0), BF
  168. LINE (olddownxt, olddownyt)-(olddownxxt, olddownyyt), _RGB(0, 0, 0), BF
  169.  
  170. shoot:
  171. shot = 1
  172. IF ds = 1 THEN
  173.     sx = xx + 3: sy = yy - 4
  174. IF ds = 2 THEN
  175.     sx = xx + 3: sy = yy + 10
  176. IF ds = 3 THEN
  177.     sx = xx - 4: sy = yy + 3
  178. IF ds = 4 THEN
  179.     sx = xx + 10: sy = yy + 4
  180.  
  181. SOUND 700, .5
  182. 'Up
  183. IF ds = 1 THEN
  184.     sy = sy - 10
  185.     shoot1:
  186.     _LIMIT 100
  187.     LINE (oldsx + 3, oldsy + 3)-(oldsx - 3, oldsy - 3), _RGB32(0, 0, 0), BF
  188.     sy = sy - 3
  189.     LINE (sx, sy)-(sx, sy - 3), _RGB32(255, 0, 0)
  190.     oldsx = sx: oldsy = sy
  191.     GOSUB checkshot:
  192.     GOTO go:
  193. 'Down
  194. IF ds = 2 THEN
  195.     sy = sy + 10
  196.     shoot2:
  197.     _LIMIT 100
  198.     LINE (oldsx - 3, oldsy - 3)-(oldsx + 3, oldsy + 3), _RGB32(0, 0, 0), BF
  199.     sy = sy + 3
  200.     LINE (sx, sy)-(sx, sy + 3), _RGB32(255, 0, 0)
  201.     oldsx = sx: oldsy = sy
  202.     GOSUB checkshot:
  203.     GOTO go:
  204. 'Left
  205. IF ds = 3 THEN
  206.     sx = sx - 10
  207.     shoot3:
  208.     _LIMIT 100
  209.     LINE (oldsx + 3, oldsy + 3)-(oldsx - 3, oldsy - 3), _RGB32(0, 0, 0), BF
  210.     sx = sx - 3
  211.     LINE (sx, sy)-(sx - 3, sy), _RGB32(255, 0, 0)
  212.     oldsx = sx: oldsy = sy
  213.     GOSUB checkshot:
  214.     GOTO go:
  215. 'Right
  216. IF ds = 4 THEN
  217.     sx = sx + 10
  218.     shoot4:
  219.     _LIMIT 100
  220.     LINE (oldsx - 3, oldsy - 3)-(oldsx + 3, oldsy + 3), _RGB32(0, 0, 0), BF
  221.     sx = sx + 3
  222.     LINE (sx, sy)-(sx + 3, sy), _RGB32(255, 0, 0)
  223.     oldsx = sx: oldsy = sy
  224.     GOSUB checkshot:
  225.     GOTO go:
  226.  
  227.  
  228. checkshot:
  229. 'Check your shot distance.
  230. sht = sht + 1
  231. IF sht > 150 THEN
  232.     sht = 0
  233.     GOSUB dscheck:
  234.     shot = 0
  235.     GOTO go:
  236.  
  237. 'Check walls and enemy.
  238. FOR tt = 1 TO p
  239.     IF sx > x(tt) - 10 AND sx < x(tt) + 10 AND sy > y(tt) - 10 AND sy < y(tt) + 10 THEN
  240.         GOSUB dscheck:
  241.         shot = 0
  242.         sht = 0
  243.         GOTO go:
  244.     END IF
  245.     IF sx > xxx - 10 AND sx < xxx + 10 AND sy > yyy - 10 AND sy < yyy + 10 THEN
  246.         FOR tttt = 1 TO 10
  247.             _LIMIT 50
  248.             CIRCLE (sx, sy), tttt, _RGB32(255, 0, 127)
  249.             CIRCLE (sx, sy), tttt + 5, _RGB32(255, 0, 127)
  250.             SOUND 100, .5
  251.             _DELAY .05
  252.             CIRCLE (sx, sy), tttt, _RGB32(0, 0, 0)
  253.             CIRCLE (sx, sy), tttt + 5, _RGB32(0, 0, 0)
  254.         NEXT tttt
  255.         CIRCLE (sx, sy), 7, _RGB32(0, 0, 0), BF
  256.         points = points + 10
  257.         points$ = STR$(points)
  258.         lives$ = STR$(lives)
  259.         titl$ = "Tank Walls     Score:" + points$ + "     Lives:" + lives$
  260.         _TITLE titl$
  261.         LINE (sx - 4, sy - 4)-(sx + 4, sy + 4), _RGB32(0, 0, 0), BF
  262.         GOSUB dscheck:
  263.         LINE (xxx - 5, yyy - 5)-(xxx + 6, yyy + 6), _RGB32(0, 0, 0), BF
  264.         shot = 0
  265.         mshot = 0
  266.         sht = 0
  267.         GOTO place:
  268.     END IF
  269. NEXT tt
  270.  
  271.  
  272. 'Your direction check to erase your old shot.
  273. dscheck:
  274. IF ds = 1 THEN LINE (sx, sy)-(sx, sy - 3), _RGB32(0, 0, 0)
  275. IF ds = 2 THEN LINE (sx, sy)-(sx, sy + 3), _RGB32(0, 0, 0)
  276. IF ds = 3 THEN LINE (sx, sy)-(sx - 3, sy), _RGB32(0, 0, 0)
  277. IF ds = 4 THEN LINE (sx, sy)-(sx + 3, sy), _RGB32(0, 0, 0)
  278.  
  279. '--------------------------------------------------------------------------------------------
  280. 'The last half of this program is what the enemy tank does.
  281. '--------------------------------------------------------------------------------------------
  282.  
  283. monster:
  284. GOSUB oldmonster:
  285.  
  286. IF xxx > xx AND yyy > yy - 10 AND yyy < yy + 10 THEN
  287.     dd = 1
  288.     GOTO monsters:
  289. IF xxx < xx AND yyy > yy - 10 AND yyy < yy + 10 THEN
  290.     dd = 2
  291.     GOTO monsters:
  292. IF yyy > yy AND xxx > xx - 10 AND xxx < xx + 10 THEN
  293.     dd = 3
  294.     GOTO monsters:
  295. IF yyy < yy AND xxx > xx - 10 AND xxx < xx + 10 THEN
  296.     dd = 4
  297.  
  298.  
  299. monsters:
  300. IF dd = 1 THEN
  301.     IF xxx > xx - 50 AND xxx < xx + 50 THEN
  302.         IF yyy > yy - 50 AND yyy < yy + 50 THEN
  303.             GOTO notcloser1:
  304.         END IF
  305.     END IF
  306.     GOSUB oldmonster:
  307.     xxx = xxx - 5
  308.     notcloser1:
  309.     GOSUB checkmonster:
  310.     LINE (oldxxx, oldyyy)-(oldxxx + 5, oldyyy + 5), _RGB(0, 0, 0), BF
  311.     GOSUB oldmonster2:
  312.     LINE (xxx, yyy)-(xxx + 5, yyy + 5), _RGB32(255, 0, 0), BF
  313.     leftxt2 = xxx - 4: leftyt2 = yyy + 2: leftxxt2 = xxx: leftyyt2 = yyy + 3
  314.     LINE (leftxt2, leftyt2)-(leftxxt2, leftyyt2), _RGB32(255, 0, 0), BF
  315. IF dd = 2 THEN
  316.     IF xxx > xx - 50 AND xxx < xx + 50 THEN
  317.         IF yyy > yy - 50 AND yyy < yy + 50 THEN
  318.             GOTO notcloser2:
  319.         END IF
  320.     END IF
  321.     GOSUB oldmonster:
  322.     xxx = xxx + 5
  323.     notcloser2:
  324.     GOSUB checkmonster:
  325.     LINE (oldxxx, oldyyy)-(oldxxx + 5, oldyyy + 5), _RGB(0, 0, 0), BF
  326.     GOSUB oldmonster2:
  327.     LINE (xxx, yyy)-(xxx + 5, yyy + 5), _RGB32(255, 0, 0), BF
  328.     rightxt2 = xxx + 5: rightyt2 = yyy + 2: rightxxt2 = xxx + 9: rightyyt2 = yyy + 3
  329.     LINE (rightxt2, rightyt2)-(rightxxt2, rightyyt2), _RGB32(255, 0, 0)
  330.  
  331. IF dd = 3 THEN
  332.     IF xxx > xx - 50 AND xxx < xx + 50 THEN
  333.         IF yyy > yy - 50 AND yyy < yy + 50 THEN
  334.             GOTO notcloser3:
  335.         END IF
  336.     END IF
  337.     GOSUB oldmonster:
  338.     yyy = yyy - 5
  339.     notcloser3:
  340.     GOSUB checkmonster:
  341.     LINE (oldxxx, oldyyy)-(oldxxx + 5, oldyyy + 5), _RGB(0, 0, 0), BF
  342.     GOSUB oldmonster2:
  343.     LINE (xxx, yyy)-(xxx + 5, yyy + 5), _RGB32(255, 0, 0), BF
  344.     upxt2 = xxx + 2: upyt2 = yyy - 4: upxxt2 = xxx + 3: upyyt2 = yyy
  345.     LINE (upxt2, upyt2)-(upxxt2, upyyt2), _RGB32(255, 0, 0), BF
  346.  
  347. IF dd = 4 THEN
  348.     IF xxx > xx - 50 AND xxx < xx + 50 THEN
  349.         IF yyy > yy - 50 AND yyy < yy + 50 THEN
  350.             GOTO notcloser4:
  351.         END IF
  352.     END IF
  353.     GOSUB oldmonster:
  354.     yyy = yyy + 5
  355.     notcloser4:
  356.     GOSUB checkmonster:
  357.     LINE (oldxxx, oldyyy)-(oldxxx + 5, oldyyy + 5), _RGB(0, 0, 0), BF
  358.     GOSUB oldmonster2:
  359.     LINE (xxx, yyy)-(xxx + 5, yyy + 5), _RGB32(255, 0, 0), BF
  360.     downxt2 = xxx + 2: downyt2 = yyy + 5: downxxt2 = xxx + 3: downyyt2 = yyy + 9
  361.     LINE (downxt2, downyt2)-(downxxt2, downyyt2), _RGB32(255, 0, 0), BF
  362.  
  363. IF mshot = 1 THEN GOTO monstershot2:
  364. rms = INT(RND * 1000) + 1
  365. IF rms > 988 THEN
  366.     mshot = 1
  367.     GOTO monstershot:
  368. GOTO go:
  369.  
  370. oldmonster:
  371. oldxxx = xxx
  372. oldyyy = yyy
  373. oldleftxt2 = leftxt2: oldleftyt2 = leftyt2: oldleftxxt2 = leftxxt2: oldleftyyt2 = leftyyt2
  374. oldrightxt2 = rightxt2: oldrightyt2 = rightyt2: oldrightxxt2 = rightxxt2: oldrightyyt2 = rightyyt2
  375. oldupxt2 = upxt2: oldupyt2 = upyt2: oldupxxt2 = upxxt2: oldupyyt2 = upyyt2
  376. olddownxt2 = downxt2: olddownyt2 = downyt2: olddownxxt2 = downxxt2: olddownyyt2 = downyyt2
  377.  
  378. oldmonster2:
  379. LINE (oldleftxt2, oldleftyt2)-(oldleftxxt2, oldleftyyt2), _RGB32(0, 0, 0), BF
  380. LINE (oldrightxt2, oldrightyt2)-(oldrightxxt2, oldrightyyt2), _RGB32(0, 0, 0), BF
  381. LINE (oldupxt2, oldupyt2)-(oldupxxt2, oldupyyt2), _RGB(0, 0, 0), BF
  382. LINE (olddownxt2, olddownyt2)-(olddownxxt2, olddownyyt2), _RGB(0, 0, 0), BF
  383.  
  384.  
  385. checkmonster:
  386. FOR tt = 1 TO p
  387.     IF xxx > x(tt) - 10 AND xxx < x(tt) + 15 AND yyy > y(tt) - 10 AND yyy < y(tt) + 15 THEN
  388.         xxx = oldxxx: yyy = oldyyy
  389.         GOSUB ddcheck:
  390.         RANDOMIZE TIMER
  391.         dd = INT(RND * 4) + 1
  392.         GOTO checkdone:
  393.     END IF
  394. NEXT tt
  395. checkdone:
  396.  
  397.  
  398. monstershot:
  399. SOUND 300, .5
  400.  
  401. IF dd = 1 THEN
  402.     mx = xxx - 4: my = yyy + 3
  403. IF dd = 2 THEN
  404.     mx = xxx + 10: my = yyy + 4
  405. IF dd = 3 THEN
  406.     mx = xxx + 3: my = yyy - 4
  407. IF dd = 4 THEN
  408.     mx = xxx + 3: my = yyy + 10
  409.  
  410. oldmx = mx
  411. oldmy = my
  412.  
  413. monstershot2:
  414. _LIMIT 500
  415. 'Left
  416. IF dd = 1 THEN
  417.     mshot1:
  418.     LINE (oldmx - 3, oldmy - 3)-(oldmx + 3, oldmy + 3), _RGB32(0, 0, 0), BF
  419.     mx = mx - 3
  420.     LINE (mx, my)-(mx - 3, my), _RGB32(255, 0, 0)
  421.     oldmx = mx: oldmy = my
  422.     GOSUB mcheckshot:
  423. 'Right
  424. IF dd = 2 THEN
  425.     mshot2:
  426.     LINE (oldmx - 3, oldmy - 3)-(oldmx + 3, oldmy + 3), _RGB32(0, 0, 0), BF
  427.     mx = mx + 3
  428.     LINE (mx, my)-(mx + 3, my), _RGB32(255, 0, 0)
  429.     oldmx = mx: oldmy = my
  430.     GOSUB mcheckshot:
  431. 'Up
  432. IF dd = 3 THEN
  433.     mshot3:
  434.     LINE (oldmx - 3, oldmy - 3)-(oldmx + 3, oldmy + 3), _RGB32(0, 0, 0), BF
  435.     my = my - 3
  436.     LINE (mx, my)-(mx, my - 3), _RGB32(255, 0, 0)
  437.     oldmx = mx: oldmy = my
  438.     GOSUB mcheckshot:
  439. 'Down
  440. IF dd = 4 THEN
  441.     mshot4:
  442.     LINE (oldmx - 3, oldmy - 3)-(oldmx + 3, oldmy + 3), _RGB32(0, 0, 0), BF
  443.     my = my + 3
  444.     LINE (mx, my)-(mx, my + 3), _RGB32(255, 0, 0)
  445.     oldmx = mx: oldmy = my
  446.     GOSUB mcheckshot:
  447.  
  448. GOTO go:
  449.  
  450. mcheckshot:
  451. 'Check his shot distance.
  452. sht2 = sht2 + 1
  453. IF sht2 > 150 THEN
  454.     sht2 = 0
  455.     GOSUB ddcheck:
  456.     mshot = 0
  457.     GOTO go:
  458. 'Check walls and if it hit your tank for his shot.
  459. FOR tt = 1 TO p
  460.     IF mx > x(tt) - 10 AND mx < x(tt) + 10 AND my > y(tt) - 10 AND my < y(tt) + 10 THEN
  461.         GOSUB ddcheck:
  462.         mshot = 0
  463.         sht2 = 0
  464.         GOTO go:
  465.     END IF
  466.     IF mx > xx - 10 AND mx < xx + 10 AND my > yy - 10 AND my < yy + 10 THEN
  467.         FOR tttt = 1 TO 10
  468.             _LIMIT 200
  469.             CIRCLE (mx, my), tttt, _RGB32(255, 0, 127)
  470.             CIRCLE (mx, my), tttt + 5, _RGB(255, 0, 127)
  471.             SOUND 100, .5
  472.             _DELAY .05
  473.             CIRCLE (mx, my), tttt, _RGB32(0, 0, 0)
  474.             CIRCLE (mx, my), tttt + 5, _RGB32(0, 0, 0)
  475.         NEXT tttt
  476.         LINE (mx - 4, my - 4)-(mx + 4, my + 4), _RGB32(0, 0, 0), BF
  477.         GOSUB ddcheck:
  478.         sht2 = 0
  479.         mshot = 0
  480.         lives = lives - 1
  481.         lives$ = STR$(lives)
  482.         titl$ = "Tank Walls     Score:" + points$ + "     Lives:" + lives$
  483.         _TITLE titl$
  484.         LINE (xx - 5, yy - 5)-(xx + 6, yy + 6), _RGB32(0, 0, 0), BF
  485.         LINE (xxx - 5, yyy - 5)-(xxx + 6, yyy + 6), _RGB32(0, 0, 0), BF
  486.         xx = 320: yy = 240
  487.         LINE (xx, yy)-(xx + 5, yy + 5), _RGB32(127, 127, 255), BF
  488.         a$ = ""
  489.         IF lives = 0 THEN
  490.             LOCATE 1, 35
  491.             PRINT "GAME OVER"
  492.             LOCATE 5, 35
  493.             INPUT "Play Again (Yes/No)"; ag$
  494.             IF ag$ = "yes" OR ag$ = "YES" OR ag$ = "Yes" OR ag$ = "yES" OR ag$ = "YEs" OR ag$ = "Y" OR ag$ = "y" THEN GOTO start:
  495.             END
  496.         END IF
  497.         GOTO place:
  498.     END IF
  499. NEXT tt
  500.  
  501.  
  502. 'His direction check to erase his old shot.
  503. ddcheck:
  504. IF dd = 1 THEN LINE (mx, my)-(mx - 3, my), _RGB32(0, 0, 0)
  505. IF dd = 2 THEN LINE (mx, my)-(mx + 3, my), _RGB32(0, 0, 0)
  506. IF dd = 3 THEN LINE (mx, my)-(mx, my - 3), _RGB32(0, 0, 0)
  507. IF dd = 4 THEN LINE (mx, my)-(mx, my + 3), _RGB32(0, 0, 0)
  508.  
  509.  
Title: Re: Tank Walls
Post by: johnno56 on July 02, 2019, 05:17:01 pm
I like the "guided" shots... Shooting around corners was a brilliant addition... I now have the chance to survive!! YES!!  Unless... It was not your intention to add the feature... and now that you know... Lovely weather today... (My feeble attempt to distract... Did it work?)
Title: Re: Tank Walls
Post by: SierraKen on July 02, 2019, 07:27:34 pm
LOL Johno, funny you say that because when I was working on it at first, it was actually not my intention for the shots to change direction as they do. But then I quickly remembered that on the Atari 2600 game Combat, there was a selection that let you do the same exact thing, so I kept it. :) I liked that feature on the game Combat the best. lol
Title: Re: Tank Walls
Post by: SierraKen on July 02, 2019, 09:59:56 pm
I am working on Tank Walls 2. This will be more game oriented than an example program. It will have 20 maps (levels). Every 100 points you go to another level. I'm about done with the code part, I just have to make 18 more maps. :) After the player has made it past level 20, it goes back to 1. The speed or difficulty won't change per level since it's pretty fast already. But this will be the first time I've ever made a game with so many different maps. Might take a few days or more to make the maps, we'll see. But I'll post the zip of all the maps and the code to the forum when I'm done, and also my website.
Title: Re: Tank Walls
Post by: Pete on July 03, 2019, 03:58:27 pm
Neat, but it could use a flow through coding method so that when you fire the blue tank, the red tank keeps moving. Just cut the delay in half, and poll the red tank every time the blue tank bullet moves one space. Restore the original delay when the bullet is terminated.

Pete
Title: Re: Tank Walls
Post by: SierraKen on July 03, 2019, 06:50:22 pm
Wow thanks Pete! All I had to do is delete the Return of the first half's part of your tank. So now the program flows straight through to the other tank in the same loop as your tank. I also had to add a "GOTO monster:" so it would skip the last little gosub section of your tank's code. I also changed the _LIMIT command on a few of them, but I might change it again later on. I don't have a _DELAY on the movement of the tanks, just on the explosions, but _LIMIT changes the speed when I make it smaller than 200 usually. All of this will be on Tank Walls 2. I've made 10 maps so far, 10 more to go and then I will release it here. :) Thanks again.