Author Topic: Tanks Battle  (Read 6096 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Tanks Battle
« on: March 04, 2019, 03:34:03 pm »
Here is code posted at [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] and Walter's forum (RIP) that recent posts remind me of, tanks taking random shots at each other until one remains:
Code: QB64: [Select]
  1. _TITLE "Tanks Battle! by bplus 2018-02-03"
  2. 'from: Tanks Battle.sdlbas (B+=MGA) 2016-10-29
  3. ' let the projectiles fly!
  4.  
  5.  
  6. 'screen stuff
  7. CONST SW = 1200
  8. CONST SH = 720
  9. CONST skyC = &HFF848888
  10.  
  11. 'tank stuff
  12. CONST tN = 15 'number of tanks
  13. CONST tNm1 = tN - 1 ' for loops and arrays
  14. CONST tW = 20 'width of tank
  15. CONST tH = 8 'height of tank
  16. TYPE tank
  17.     x AS SINGLE
  18.     y AS SINGLE
  19.     da AS SINGLE
  20.     v AS SINGLE 'velocity
  21.     c AS _INTEGER64 'color
  22.     bx AS SINGLE 'barrel
  23.     by AS SINGLE
  24.     f AS _BYTE 'finished
  25.  
  26. 'hole stuff
  27. CONST hR = tW + 3
  28. CONST topHole = 1000
  29. TYPE hole
  30.     x AS INTEGER
  31.     y AS INTEGER
  32.  
  33. 'projectile stuff
  34. CONST rightA = -10
  35. CONST leftA = -170
  36. CONST lVel = 7
  37. CONST hVel = 22
  38. CONST pC = &HFFFFFF00
  39. CONST gravity = .35
  40.  
  41. SCREEN _NEWIMAGE(SW, SH, 32)
  42.  
  43. COMMON SHARED rad, deg
  44. deg = 180 / _PI
  45. rad = _PI / 180
  46.  
  47. ff$ = "arial" ' I have loaded and tested many fonts from Windows Folder and disappointed how few work with QB64
  48. 'load and check Big size font
  49. bArial& = _LOADFONT("C:\windows\fonts\" + ff$ + ".ttf", 48, "BOLD")
  50. IF bArial& <= 0 THEN PRINT "Trouble with " + ff$ + ".ttf size 48 file, goodbye.": SLEEP: END
  51. 'bFW = _FONTWIDTH(bArial&): bFH = _FONTHEIGHT(bArial&)
  52. '_FONT bArial&
  53. 'LOCATE 1, 1: PRINT "This is BIG font."
  54. 'SLEEP
  55.  
  56.  
  57. DIM SHARED tanks(tNm1) AS tank, holes(topHole) AS hole
  58.  
  59. 'get holes set up
  60. holeIndex = -1
  61.  
  62. land& = _NEWIMAGE(SW, SH, 32)
  63. _DEST land&
  64. drawLandscape
  65.  
  66. initializeTanks
  67. hotTank = tNm1
  68.  
  69. change = 1
  70. WHILE change 'get tanks landed before start shooting
  71.     change = 0
  72.     CLS
  73.     _PUTIMAGE , land&, 0 'land the tanks and reland the tanks if the dirt is shot out under them
  74.     FOR i = 0 TO tNm1
  75.         IF POINT(tanks(i).x + tW / 2, tanks(i).y + tH + 1) = skyC THEN
  76.             tanks(i).y = tanks(i).y + 2
  77.             change = 1
  78.         END IF
  79.         drawTank i
  80.     NEXT
  81.     _DISPLAY
  82.  
  83. WHILE 1 '< main loop start
  84.     CLS
  85.     _PUTIMAGE , land&, 0
  86.  
  87.     'the land with holes
  88.     IF holeIndex > -1 THEN
  89.         FOR ii = 0 TO holeIndex
  90.             drawHole holes(ii).x, holes(ii).y
  91.         NEXT
  92.     END IF
  93.  
  94.     'reland the tanks if the dirt is shot out under them
  95.     FOR i = 0 TO tNm1
  96.         IF tanks(i).f = 0 THEN
  97.             WHILE POINT(tanks(i).x + tW / 2, tanks(i).y + tH + 1) = skyC
  98.                 tanks(i).y = tanks(i).y + 2
  99.             WEND
  100.  
  101.             'repoint barrels and reset velocitys
  102.             IF RND < .5 THEN 'avoid straight up and down  suicide shots
  103.                 tanks(i).da = rand(leftA, -92)
  104.             ELSE
  105.                 tanks(i).da = rand(rightA, -88)
  106.             END IF
  107.             tanks(i).v = rand(lVel, hVel) 'velocity
  108.             drawTank i
  109.         END IF
  110.     NEXT
  111.     _DISPLAY
  112.     _DELAY .1
  113.  
  114.  
  115.     ''whose turn to shoot
  116.     lastMan = hotTank
  117.     hotTank = hotTank + 1
  118.     hotTank = hotTank MOD tN
  119.     WHILE tanks(hotTank).f = 1 'look for a tank still alive
  120.         hotTank = hotTank + 1 'whose turn to shoot
  121.         hotTank = hotTank MOD tN
  122.         'did we cycle through all the dead tanks?
  123.         IF hotTank = lastMan THEN 'game over, last man standing
  124.             COLOR _RGB32(220, 255, 0), skyC
  125.             _FONT bArial&
  126.             _PRINTSTRING (SW / 2 - 120, SH / 2 - 80), "Game Over!"
  127.             _DISPLAY
  128.             _DELAY 5
  129.             _FONT 16
  130.             SLEEP
  131.             END
  132.         END IF
  133.     WEND
  134.  
  135.     'setup hotTank's shot
  136.     rAngle = tanks(hotTank).da * rad 'convert here to radians for SIN and COS
  137.     pX = tanks(hotTank).bx
  138.     pY = tanks(hotTank).by
  139.     pX_change = tanks(hotTank).v * COS(rAngle) 'this is the cuurent  X vector of the projectile
  140.     pY_change = tanks(hotTank).v * SIN(rAngle) ' this is the current Y vector of the projectile
  141.     pActive = 0 ' do not Activate until projectile sees the skyC
  142.  
  143.     WHILE 1
  144.         pY_change = pY_change + gravity ' pY starts in upward direction but will eventually fall due to gravity
  145.         pX = pX + pX_change
  146.         pY = pY + pY_change
  147.  
  148.         'show projectile progress, hit or air
  149.         IF pX >= 0 AND pX <= SW AND pY <= SH THEN ' still active
  150.             'check for tank hit
  151.             FOR iTank = 0 TO tNm1
  152.                 IF tanks(iTank).f <> 1 AND pActive THEN 'tanks can blow up themselves
  153.                     IF dist(pX, pY, tanks(iTank).x + tW / 2, tanks(iTank).y + tH / 2) < hR THEN
  154.                         tanks(iTank).f = 1
  155.                         COLOR _RGB32(255, 0, 0)
  156.                         FOR rr = 1 TO hR
  157.                             fcirc pX, pY, rr
  158.                             _DISPLAY
  159.                             _DELAY .01
  160.                             IF rr MOD 2 THEN
  161.                                 COLOR _RGB32(128, 255, 0)
  162.                             ELSE
  163.                                 COLOR _RGB32(255, 0, 0)
  164.                             END IF
  165.                         NEXT
  166.                         IF holeIndex < topHole THEN
  167.                             holeIndex = holeIndex + 1
  168.                             holes(holeIndex).x = pX
  169.                             holes(holeIndex).y = pY
  170.                             drawHole pX, pY
  171.                             _DISPLAY
  172.                         END IF
  173.                         pX = SW + 10
  174.                         pY = SH + 10
  175.                         EXIT WHILE
  176.                     END IF
  177.                 END IF
  178.             NEXT
  179.  
  180.             IF POINT(pX, pY) = skyC THEN
  181.                 pActive = 1
  182.                 COLOR pC
  183.                 fcirc pX, pY, 2 ' <<<<<<<<<<<<<<<< to see round projectiles that could be replaced by image
  184.             ELSEIF pY < 0 THEN
  185.                 'still hot but cant see
  186.             ELSEIF POINT(pX, pY) <> skyC AND POINT(pX, pY) <> pC AND pActive THEN 'hit ground?
  187.                 COLOR _RGB(255, 0, 0)
  188.                 FOR rr = 1 TO hR
  189.                     fcirc pX, pY, rr
  190.                     _DISPLAY
  191.                     _DELAY .01
  192.                     IF rr MOD 2 THEN
  193.                         COLOR _RGB32(128, 255, 0)
  194.                     ELSE
  195.                         COLOR _RGB32(255, 0, 0)
  196.                     END IF
  197.                 NEXT
  198.                 IF holeIndex < topHole THEN
  199.                     holeIndex = holeIndex + 1
  200.                     holes(holeIndex).x = pX
  201.                     holes(holeIndex).y = pY
  202.                     drawHole pX, pY
  203.                     _DISPLAY
  204.                 END IF
  205.                 pX = SW + 10
  206.                 pY = SH + 10
  207.                 EXIT WHILE
  208.             END IF
  209.         ELSE 'not active
  210.             EXIT WHILE
  211.         END IF
  212.         _DISPLAY
  213.         _DELAY .03
  214.     WEND
  215.  
  216. SUB drawHole (xx, yy)
  217.     COLOR skyC
  218.     FOR i = yy TO 300 STEP -1
  219.         fcirc xx, i, hR
  220.     NEXT
  221.  
  222. SUB drawLandscape
  223.     'the sky
  224.     LINE (0, 0)-(SW, SH), skyC, BF
  225.  
  226.     'the land
  227.     startH = SH - 100
  228.     rr = 70: gg = 70: bb = 90
  229.     FOR mountain = 1 TO 6
  230.         Xright = 0
  231.         y = startH
  232.         WHILE Xright < SW
  233.             ' upDown = local up / down over range, change along Y
  234.             ' range = how far up / down, along X
  235.             upDown = (RND * (.8) - .35) * (mountain * .5)
  236.             range = Xright + rand%(15, 25) * 2.5 / mountain
  237.             FOR x = Xright - 1 TO range
  238.                 y = y + upDown
  239.                 LINE (x, y)-(x + 1, SH), _RGB32(rr, gg, bb), BF
  240.             NEXT
  241.             Xright = range
  242.         WEND
  243.         rr = rand(rr - 15, rr): gg = rand(gg - 15, gg): bb = rand(bb - 25, bb)
  244.         IF rr < 0 THEN rr = 0
  245.         IF gg < 0 THEN gg = 0
  246.         IF bb < 0 THEN bb = 0
  247.         startH = startH + rand(5, 20)
  248.     NEXT
  249.  
  250. SUB initializeTanks ' x, y, barrel angle,  velocity, color
  251.     tl = (SW - tW) / tN: tl2 = tl / 2: tl4 = .8 * tl2
  252.     FOR i = 0 TO tNm1
  253.         tanks(i).x = rand%(tl2 + tl * i - tl4 - tW, tl2 + tl * i + tl4 - tW)
  254.         tanks(i).y = 300 '<<<<<<<<<<<<<<<<<<<<<<<<<< for testing
  255.         tanks(i).da = rand%(-180, 0) 'degree Angle
  256.         tanks(i).v = rand%(10, 20) 'velocity
  257.         IF tanks(i).da < -90 THEN 'barrel  is pointed left
  258.             tanks(i).v = -1 * tanks(i).v
  259.         END IF
  260.         tc = i * INT(200 / (3 * tN)) 'maximize color difference between tanks
  261.         tanks(i).c = _RGB32(55 + 2 * tc, 13 + tc, 23 + tc) ' first tank is darkest
  262.     NEXT
  263.     'shuffle color order
  264.     FOR i = tNm1 TO 1 STEP -1
  265.         r = rand%(0, i)
  266.         SWAP tanks(i).x, tanks(r).x
  267.     NEXT
  268.  
  269. SUB drawTank (i)
  270.     'ink(tanks(i, "c"))
  271.     COLOR tanks(i).c
  272.     'turret
  273.     fEllipse tanks(i).x + tW / 2, tanks(i).y + tH / 3, tW / 4 + 1, tH / 4 + 1
  274.     bX = tW / 2 * COS(rad * tanks(i).da)
  275.     bY = tW / 2 * SIN(rad * tanks(i).da)
  276.     LINE (tanks(i).x + tW / 2, tanks(i).y + tH / 3)-(tanks(i).x + tW / 2 + bX, tanks(i).y + tH / 4 + bY)
  277.     LINE (tanks(i).x + tW / 2 + 1, tanks(i).y + tH / 3 + 1)-(tanks(i).x + tW / 2 + bX + 1, tanks(i).y + tH / 4 + bY + 1)
  278.     tanks(i).bx = tanks(i).x + tW / 2 + bX
  279.     tanks(i).by = tanks(i).y + tH / 4 + bY
  280.     fEllipse tanks(i).x + tW / 2, tanks(i).y + .75 * tH, tW / 2, tH / 4
  281.     COLOR _RGB32(0, 0, 0)
  282.     ellipse tanks(i).x + tW / 2, tanks(i).y + .75 * tH, tW / 2 + 1, tH / 4 + 1
  283.     ellipse tanks(i).x + tW / 2 + 1, tanks(i).y + .75 * tH, tW / 2 + 1, tH / 4 + 1
  284.  
  285. FUNCTION rand% (lo%, hi%)
  286.     rand% = (RND * (hi% - lo% + 1)) \ 1 + lo%
  287.  
  288. FUNCTION rdir% ()
  289.     IF RND < .5 THEN rdir% = -1 ELSE rdir% = 1
  290.  
  291. FUNCTION dist# (x1%, y1%, x2%, y2%)
  292.     dist# = ((x1% - x2%) ^ 2 + (y1% - y2%) ^ 2) ^ .5
  293.  
  294. 'Steve McNeil's  copied from his forum   note: Radius is too common a name
  295. SUB fcirc (CX AS LONG, CY AS LONG, R AS LONG)
  296.     DIM subRadius AS LONG, RadiusError AS LONG
  297.     DIM X AS LONG, Y AS LONG
  298.  
  299.     subRadius = ABS(R)
  300.     RadiusError = -subRadius
  301.     X = subRadius
  302.     Y = 0
  303.  
  304.     IF subRadius = 0 THEN PSET (CX, CY): EXIT SUB
  305.  
  306.     ' Draw the middle span here so we don't draw it twice in the main loop,
  307.     ' which would be a problem with blending turned on.
  308.     LINE (CX - X, CY)-(CX + X, CY), , BF
  309.  
  310.     WHILE X > Y
  311.         RadiusError = RadiusError + Y * 2 + 1
  312.         IF RadiusError >= 0 THEN
  313.             IF X <> Y + 1 THEN
  314.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), , BF
  315.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), , BF
  316.             END IF
  317.             X = X - 1
  318.             RadiusError = RadiusError - X * 2
  319.         END IF
  320.         Y = Y + 1
  321.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), , BF
  322.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), , BF
  323.     WEND
  324.  
  325. SUB fEllipse (CX AS LONG, CY AS LONG, xRadius AS LONG, yRadius AS LONG)
  326.     DIM scale AS SINGLE, x AS LONG, y AS LONG
  327.     scale = yRadius / xRadius
  328.     LINE (CX, CY - yRadius)-(CX, CY + yRadius), , BF
  329.     FOR x = 1 TO xRadius
  330.         y = scale * SQR(xRadius * xRadius - x * x)
  331.         LINE (CX + x, CY - y)-(CX + x, CY + y), , BF
  332.         LINE (CX - x, CY - y)-(CX - x, CY + y), , BF
  333.     NEXT
  334.  
  335. SUB ellipse (CX AS LONG, CY AS LONG, xRadius AS LONG, yRadius AS LONG)
  336.     DIM scale AS SINGLE, xs AS LONG, x AS LONG, y AS LONG
  337.     DIM lastx AS LONG, lasty AS LONG
  338.     scale = yRadius / xRadius: xs = xRadius * xRadius
  339.     PSET (CX, CY - yRadius): PSET (CX, CY + yRadius)
  340.     lastx = 0: lasty = yRadius
  341.     FOR x = 1 TO xRadius
  342.         y = scale * SQR(xs - x * x)
  343.         LINE (CX + lastx, CY - lasty)-(CX + x, CY - y)
  344.         LINE (CX + lastx, CY + lasty)-(CX + x, CY + y)
  345.         LINE (CX - lastx, CY - lasty)-(CX - x, CY - y)
  346.         LINE (CX - lastx, CY + lasty)-(CX - x, CY + y)
  347.         lastx = x: lasty = y
  348.     NEXT
  349.  
  350.  
Tanks Battle.PNG
* Tanks Battle.PNG (Filesize: 12.27 KB, Dimensions: 1201x737, Views: 296)

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Tanks Battle
« Reply #1 on: March 04, 2019, 04:05:04 pm »
Tanks for posting this. :P Well, someone had to say it... Alright fine, I had to say it!

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

Offline qb4ever

  • Newbie
  • Posts: 40
  • LOCATE 15,15: COLOR 14: PRINT "Hello World!"
    • View Profile
Re: Tanks Battle
« Reply #2 on: March 05, 2019, 04:59:40 am »
Hi bplus,

return "invalid name on line 48"

Can you help me ?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tanks Battle
« Reply #3 on: March 05, 2019, 08:21:02 am »
Hi bplus,

return "invalid name on line 48"

Can you help me ?

Line 48 says this:
Code: QB64: [Select]
  1. deg = 180 / _PI  
  2.  

When I saw your message, I was sure that the problem line would be a few more lines down about loading the font.
I forgot to mention it's a Window's location and font and it is not essential for program to have. Any nice font would do for a message in big print at the end when one tank left, even the default font.

_PI is a QB64 function so that name should be OK.

So what is wrong with "deg"? Got me???

I would comment it out and see what errors next.

If it's just deg, oh ha! never used in program! Just comment it out but I bet if your system flags "deg" then more flags to come.

BTW, I wrote this before I knew QB64 had a function that coverts an angle in radian units to one in degrees _R2D(radianAngle) and the reverse _D2R(degreeAngle). 
« Last Edit: March 05, 2019, 08:39:30 am by bplus »

FellippeHeitor

  • Guest
Re: Tanks Battle
« Reply #4 on: March 05, 2019, 08:38:27 am »
qb4ever could you please report what QB64 version you get when you click Help->About? If that's the first occurrence of _PI in the code, then this is a case of using a very old QB64 version, as deg is not a keyword.

Offline qb4ever

  • Newbie
  • Posts: 40
  • LOCATE 15,15: COLOR 14: PRINT "Hello World!"
    • View Profile
Re: Tanks Battle
« Reply #5 on: March 05, 2019, 01:24:59 pm »
qb4ever could you please report what QB64 version you get when you click Help->About? If that's the first occurrence of _PI in the code, then this is a case of using a very old QB64 version, as deg is not a keyword.

Hi Fellippe, now I have download the last version of QB64 and all are OK.

Bplus, congratulations, great job!


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tanks Battle
« Reply #6 on: March 05, 2019, 02:14:29 pm »
Thanks qb4ever, you know it was your Knight VS Castle that reminded me of this code project. I wanted to help with that, but as Johnno noted my help tends go overboard. So maybe this projectiles example might serve or maybe a smaller projectile study?

So we learn "Invalid name" only applies to _var that isn't a QB64 keyword. :)


Offline qb4ever

  • Newbie
  • Posts: 40
  • LOCATE 15,15: COLOR 14: PRINT "Hello World!"
    • View Profile
Re: Tanks Battle
« Reply #7 on: March 05, 2019, 02:18:49 pm »
Thanks qb4ever, you know it was your Knight VS Castle that reminded me of this code project. I wanted to help with that, but as Johnno noted my help tends go overboard. So maybe this projectiles example might serve or maybe a smaller projectile study?

So we learn "Invalid name" only applies to _var that isn't a QB64 keyword. :)


for elliptic trajectories I used the math trinomio Y = (ax^2 + bx + c)... but is very old programming style....  :D

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tanks Battle
« Reply #8 on: March 05, 2019, 05:15:14 pm »
Quote
for elliptic trajectories I used the math trinomio Y = (ax^2 + bx + c)... but is very old programming style....  :D

Yes that's what they teach in school but in programming you need:
The angle of the cannon, the exit velocity, gravity constant and the Calculus idea of change of position over change in time and maybe air resistance like a strong wind blowing left to right.

The change over time is just one frame of display in a loop, so you calculate how much vertical and horizontal change occurs from one frame to the next.

Are you ready for some math? The worst of it is at the start:
the change in horizontal distance (dx) = exit velocity * cos(cannon angle to the ground)
the change in vertical distance   (dy) = exit velocity * sin(cannon angle to the ground)

Now in each loop you recalc dx and dy, the change in x position and the change in y position.
dx = dx + air resistance which is positive or neg depending on wind and direction of projectile.
dy = dy + gravity which pulls down the projectile faster and faster as each frame goes by.

So the actual position of the projectile frame by frame is:
x = x + dx
y = y + dy

With new x, y calculated you draw the projectile, unless x, y puts it into an object or ground, then you handle a collision.

How do you calculate the angle of the cannon? you ask.

radian Angle of cannon = _ATAN2(y height of mouth - y height of butt, x position of mouth - x position of butt)

The barest bones of a demo:
Code: QB64: [Select]
  1. _TITLE "Projectile study" 'B+ 2019-03-05
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. _SCREENMOVE 200, 20
  4.  
  5. ground = 590 'up is negative in direction
  6.  
  7. cbx = 10 '              cannon butt end x, y
  8. cby = ground - 10
  9. cmx = 50 '              cannon mouth end
  10. cmy = ground - 70
  11.  
  12. 'cannon angle  using mouth x, y and butt x, y
  13. ca = _ATAN2(cmy - cby, cmx - cbx) 'Here is how to get the cannon angle from the mouth and butt ends of cannon
  14.  
  15. 'PRINT _R2D(ca) '>>>>>>>>>>> check angle in degrees  due East  is 0 degrees and -Angle is counter clockwise to that
  16.  
  17. vel = 10 'pixels
  18. g = .15 '       with air resistance
  19. airX = -.005 '         wind blows against direction of shot
  20. COLOR , _RGB32(200, 200, 255)
  21. WHILE _KEYDOWN(27) = 0
  22.  
  23.     'initialize
  24.     bx = cmx 'ball x, y same as cannon mouth at start of shot
  25.     by = cmy
  26.  
  27.  
  28.     dx = vel * COS(ca) 'start at cannon mouth
  29.     dy = vel * SIN(ca)
  30.  
  31.     'shot
  32.     DO
  33.         CLS 'sky
  34.         LINE (0, ground)-(800, 600), _RGB32(0, 128, 0), BF 'ground
  35.         LINE (cbx, cby)-(cmx, cmy), _RGB32(150, 50, 0) 'cannon line
  36.         CIRCLE (bx, by), 5, _RGB32(0, 0, 0)
  37.         PAINT (bx, by), _RGB32(0, 0, 0), _RGB32(0, 0, 0)
  38.         dx = dx + airX
  39.         dy = dy + g
  40.         bx = bx + dx
  41.         by = by + dy
  42.         _DISPLAY
  43.         _LIMIT 30
  44.     LOOP UNTIL bx > 800 OR by > ground
  45.  
  46.  

Play with variables specially the cannon mouth height which alters the cannon angle and the initial vel (velocity) and be god like and play with gravity or see what happens when AirX blows the opposite direction.
« Last Edit: March 05, 2019, 05:19:19 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Tanks Battle
« Reply #9 on: March 05, 2019, 11:34:54 pm »
Cool demo. Had to modify _loadfont... other than that, ran like clockwork

Tanks a lot... (sorry... couldn't resist... lol...)
Logic is the beginning of wisdom.

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Tanks Battle
« Reply #10 on: March 06, 2019, 01:38:09 am »
Nice :)
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: Tanks Battle
« Reply #11 on: June 22, 2019, 11:03:47 pm »
LOL these are some awesome games! The first one I played until the game was over. lol I might use some of this code to make a 1 player game against the computer, if I can figure it out. Thanks for telling me about this thread!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tanks Battle
« Reply #12 on: June 23, 2019, 08:04:08 am »
You know, Projectile Study might make a nice little app for InForm where you can tinker with variable values and test cannon shots.

FellippeHeitor

  • Guest
Re: Tanks Battle
« Reply #13 on: June 23, 2019, 08:52:52 am »
You know, Projectile Study might make a nice little app for InForm where you can tinker with variable values and test cannon shots.

😉

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Tanks Battle
« Reply #14 on: June 23, 2019, 02:24:27 pm »
Bplus
Very fine!
When I copy the code and run in QB64 1.3 it warning me with 276 out of range! Continue ? But clicking on Yes it continues working well.
Thanks to share.
Programming isn't difficult, only it's  consuming time and coffee