Author Topic: Artillery Wanted  (Read 11188 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Artillery Wanted
« on: June 22, 2019, 10:43:28 pm »
Does anyone remember some of the very first PC games from the 70's and early 80's? One really popular one was called Artillery. You shot over a mountain to try and hit your opponents cannon. You first set your angle and velocity. It was a 2 or 3 player game, depending on which version. Looking at some websites about it, there was one made in Turbo Basic back in the day but nothing else I can find so far. Would love to try and make it. I might someday. I guess it wouldn't be too hard to make the holes if you use the PAINT fill-in after you draw the land and wherever your cannonball hits, it makes a big hole. Was a really fun game. I might even try to make it a 1 player game. :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Artillery Wanted
« Reply #1 on: June 22, 2019, 10:53:41 pm »
Here is something I did with tanks:
https://www.qb64.org/forum/index.php?topic=1130.msg103232#msg103232

I started a projectile study in that thread too.

The Gorilla that throws exploding banana's is a classic, Nibbles? was it?

Nibbles was the snake game, Gor64 in programs of QB64 samples is the Gorillas Game.

BTW have you looked through the sample programs?
« Last Edit: June 22, 2019, 11:03:23 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Artillery Wanted
« Reply #2 on: June 22, 2019, 11:06:13 pm »
Wow now I haven't, they are a bit buried in the folders so I'll copy them and put them with the rest of mine. :) Awesome stuff!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Artillery Wanted
« Reply #3 on: June 22, 2019, 11:13:18 pm »
ROFL I totally forgot about Gorilla. I love it! LOL

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Artillery Wanted
« Reply #4 on: June 23, 2019, 08:54:54 am »
Tektronix 4051 computer of the mid 70's had a demo program 'Artillery'. In 1980, 'Artillery' and 'Super Artillery', were released on the Apple2.

I believe that this is the game you are referring to?

 
Artillery_apple.png


I may have the listing somewhere buried amongst my files... Do not hold your breath waiting... lol

J
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Artillery Wanted
« Reply #5 on: June 23, 2019, 09:07:19 am »
Oh Johnno, that reminds me of something I saw in JB, maybe I can find it and translate...

It also reminds me of something we (you?) started on at SdlBasic... maybe I can did that up too? (or better left buried   ;-)  )

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Artillery Wanted
« Reply #6 on: June 23, 2019, 09:08:14 am »
Found it!

J
* artillery.bas (Filesize: 4.15 KB, Downloads: 209)
Logic is the beginning of wisdom.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Artillery Wanted
« Reply #7 on: June 23, 2019, 09:09:40 am »
Dig away... Your memory is obviously better than mine... lol
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Artillery Wanted
« Reply #8 on: June 23, 2019, 09:28:58 am »
Found JB game, looks familiar supposedly copyright by Carl but obviously this game comes from Johnno's.

Oh and look, it's GUI, great minds think alike! (or just copy one another without realizing)

 
JB Mayham.PNG



Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Artillery Wanted
« Reply #9 on: June 23, 2019, 09:45:24 am »
Did you spot the technical glitch with the image? The wind is travelling from right to left at a velocity of 19, right? Then why is the flag of the right hand tank fluttering in the opposite direction? Ka-ching! Ding. Ding. Ding. And the prize goes to.....

Basic's with GUI libraries... Not all have them but I think they should....  I miss the old Scorched Earth.... I have the latest '3D' version but it doesn't have the same 'feel' as the old version...
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Artillery Wanted
« Reply #10 on: June 23, 2019, 10:22:29 am »
Hi Johnno,

I found the folder, I don't have SdlBasic running on this computer, is there anything worth translating to QB64?
BTW my first version of Tanks Battle was born from this study and at Naalaa for a Gorilla clone.

BTW if anyone needs a Gorilla... ;-))

PS nothing wrong with your eyesight! ;-)

* artillery.zip (Filesize: 40.56 KB, Downloads: 170)
« Last Edit: June 23, 2019, 10:28:38 am by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Artillery Wanted
« Reply #11 on: June 23, 2019, 12:23:34 pm »
WOW Thanks guys! I'll take a look at those 2 later today!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Artillery Wanted
« Reply #12 on: June 23, 2019, 04:41:54 pm »
Looks like that was made with an Apple computer or something similar. I tried converting it but it looks pretty difficult without messing anything up. I'm still going to see if I can find the math for my own game though on this. Thanks.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Artillery Wanted
« Reply #13 on: June 23, 2019, 08:07:50 pm »
B+ I used your "Projectile Study" code to make a similar game. Here is what I have so far. I hope it's OK with you that I use this code. If I make a game good enough, I'll add the program to my website with your name as well as mine. Of course I will never sell anything I put on my website or with code that anyone people posts. I am still am amateur programmer and probably always will be. Anyway, here is the code I have so far. I figured out how to ask the user for degrees and power. I also changed the colors a tiny bit on the sky and land and made the window much larger. Plus I made a sound and funky explosion lol. Feel free to use my code too of course. This isn't really a game so far but more of a simulator but later on I will probably see if I can make you go against the computer, kinda like I did with Ping Pong lol (but not impossible LOL). Thank you tons for posting that code. Here is what I did with it so far:
Code: QB64: [Select]
  1. 'Thank you to B+ for posting much of this code on the QB64.org Forum!
  2.  
  3. _TITLE "Ken's Artillery"
  4. SCREEN _NEWIMAGE(1600, 800, 32)
  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.  
  13. g = .15 '       with air resistance
  14. airX = -.005 '         wind blows against direction of shot
  15. COLOR , _RGB32(156, 210, 237)
  16. LINE (0, ground)-(1600, 800), _RGB32(74, 86, 58), BF 'ground
  17. LINE (cbx, cby)-(cmx, cmy), _RGB32(150, 50, 0) 'cannon line
  18.  
  19. GOSUB coords:
  20.  
  21. again:
  22. 'initialize
  23. bx = cmx 'ball x, y same as cannon mouth at start of shot
  24. by = cmy
  25.  
  26.  
  27. dx = vel * COS(ca) 'start at cannon mouth
  28. dy = vel * SIN(ca)
  29.  
  30. 'shot
  31.     CLS 'sky
  32.     a$ = INKEY$
  33.     IF a$ = CHR$(27) THEN END
  34.     LINE (0, ground)-(1600, 800), _RGB32(74, 86, 58), 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.     IF by > ground THEN
  45.         FOR explosion = 10 TO 50 STEP 5
  46.             CIRCLE (bx, by), explosion, _RGB32(4, 4, 4)
  47.             SOUND 150 + (explosion * 5), 1
  48.         NEXT explosion
  49.     END IF
  50. LOOP UNTIL bx > 1600 OR by > ground OR bx < 0
  51. GOSUB coords:
  52. GOTO again:
  53. coords:
  54. COLOR _RGB(0, 0, 0)
  55. LOCATE 1, 1: INPUT "Power (0-80):", vel
  56. LOCATE 2, 1: INPUT "Angle (0-360): ", a
  57. going:
  58. vel = INT(vel / 4)
  59. IF a > 360 THEN a = 360
  60. IF a < 0 THEN a = 0
  61. IF vel < 0 THEN vel = 0
  62. IF vel > 80 THEN vel = 80
  63. a = 360 - a
  64. ca = _D2R(a)
  65.  


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Artillery Wanted
« Reply #14 on: June 23, 2019, 09:01:07 pm »
Hi SierraKen,

For angle, I'd make the allowable range between 0 and 90 degrees. Nice that you figured to subtract the input angle from 360 degrees.

I have worked out a way to set angle with mouse and to use up and down arrow keys to change speed so there is no input for extra enter key press.

The cannon should adjust it's angle to the input angle before firing in my opinion.

The math for that:
If the angle input is 20 degrees then subtract from 360 = 340 as you have done for firing the projectile.
Convert 340 degrees to radians: use _D2R(340) or 340 * _PI / 180, now you have a number SIN and COS can use.

Say the cannon length is 100 then the X coordinate will be ( with butt end coord's (bx, by) )
exit end = bx + 100 * COS(_D2R(340))
exit end = by - 100 * SIN(_D2R(340))   because raising the cannon mouth is decreasing the y coordinate value.

BTW you must have a giant screen, on my laptop I reduce x to 1200 and y to 700. :)