Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Dec 2004
Posts: 14
Reputation: Tom Pilk is an unknown quantity at this point 
Solved Threads: 0
Tom Pilk's Avatar
Tom Pilk Tom Pilk is offline Offline
Newbie Poster

A little game

 
0
  #1
Dec 31st, 2004
Can anyone make this game any better because at the moment i am stuck. I have been doing it for fun and with my friend - cue Lewis Houghton. It is below what we have done so far:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. DECLARE SUB Battle ()
  2.  
  3. ON ERROR GOTO errline
  4.  
  5. DIM guy(50), guysh(50)
  6. DIM sprite1(50), sprite2(50), sprite3(50)
  7. DIM map1(21, 15), enemy(100)
  8. SCREEN 13
  9.  
  10. guyname$ = "Bob the Brave"
  11. guyhealth = 100
  12. guymaxhealth = 100
  13. guydamage = 10
  14. guybasedamage = 3
  15. guylevel = 1
  16. guyexp = 0
  17. guyweapon$ = "Dagger"
  18. guydefense = 10
  19. guybasedefence = 3
  20. guyarmour$ = "Clothing"
  21.  
  22. enemyname$ = "Blob"
  23. enemyhealth = 25
  24. enemymaxhealth = 25
  25. enemydamage = 7
  26. enemybasedamage = 1
  27. enemyweapon$ = "Itself"
  28. enemydefense = 5
  29. enemybasedefence = 1
  30. enemyarmour$ = "Slime"
  31. experiencegive = 38
  32.  
  33. level2exp = 100
  34. level3exp = 175
  35. level4exp = 275
  36. level5exp = 400
  37. level6exp = 550
  38. level7exp = 725
  39. level8exp = 925
  40. level9exp = 1150
  41. level10exp = 1400
  42.  
  43. guyX = 20
  44. guyY = 8
  45.  
  46. xe = 160
  47. ye = 100
  48. re = 8
  49.  
  50. FOR y = 1 TO 13
  51. FOR x = 1 TO 15
  52.  
  53. READ clr
  54. PSET (x, y), clr
  55.  
  56. NEXT: NEXT
  57. GET (1, 1)-(15, 13), sprite1
  58.  
  59. FOR y = 1 TO 13
  60. FOR x = 1 TO 15
  61.  
  62. READ clr
  63. PSET (x, y), clr
  64.  
  65. NEXT: NEXT
  66. GET (1, 1)-(15, 13), sprite2
  67.  
  68. FOR y = 1 TO 13
  69. FOR x = 1 TO 15
  70.  
  71. READ clr
  72. PSET (x, y), clr
  73.  
  74. NEXT: NEXT
  75. GET (1, 1)-(15, 13), sprite3
  76.  
  77. CLS
  78. FOR y = 1 TO 15
  79. FOR x = 1 TO 21
  80. READ map1(x, y)
  81. NEXT: NEXT
  82.  
  83.  
  84. FOR y = 1 TO 13
  85. FOR x = 1 TO 15
  86.  
  87. READ clr
  88. PSET (x, y), clr
  89.  
  90. NEXT: NEXT
  91. GET (1, 1)-(15, 13), guy
  92.  
  93. FOR y = 1 TO 13
  94. FOR x = 1 TO 15
  95.  
  96. READ clr
  97. PSET (x, y), clr
  98.  
  99. NEXT: NEXT
  100. GET (1, 1)-(15, 13), guysh
  101. CLS
  102.  
  103. LINE (0, 0)-(18, 16), 10, BF
  104.  
  105. CIRCLE (9, 8), re, 4
  106. PAINT (7, 7), 4, 4
  107. GET (0, 0)-(18, 16), enemy
  108.  
  109. CLS
  110.  
  111. FOR y = 1 TO 15
  112. FOR x = 1 TO 21
  113.  
  114. IF map1(x, y) = 1 THEN PUT (x * 15 - 15, y * 13 - 13), sprite1
  115. IF map1(x, y) = 2 THEN PUT (x * 15 - 15, y * 13 - 13), sprite2
  116. IF map1(x, y) = 3 THEN PUT (x * 15 - 15, y * 13 - 13), sprite3
  117. NEXT: NEXT
  118.  
  119. PUT (guyX * 15 - 15, guyY * 13 - 13), guysh, AND
  120. PUT (guyX * 15 - 15, guyY * 13 - 13), guy, OR
  121. start:
  122. DO
  123. press$ = INKEY$
  124.  
  125. IF press$ = CHR$(0) + CHR$(75) AND map1(guyX - 1, guyY) <> 3 THEN
  126. IF guyX > 1 THEN guyX = guyX - 1
  127. END IF
  128.  
  129. IF press$ = CHR$(0) + CHR$(77) AND map1(guyX + 1, guyY) <> 3 THEN
  130. IF guyX < 20 THEN guyX = guyX + 1
  131. END IF
  132.  
  133. IF press$ = CHR$(0) + CHR$(72) AND map1(guyX, guyY - 1) <> 3 THEN
  134. IF guyY > 1 THEN guyY = guyY - 1
  135. END IF
  136.  
  137. IF press$ = CHR$(0) + CHR$(80) AND map1(guyX, guyY + 1) <> 3 THEN
  138. IF guyY < 14 THEN guyY = guyY + 1
  139. END IF
  140.  
  141. IF oldguyx <> guyX OR oldguyy <> guyY THEN
  142. oldguyx = guyX
  143. oldguyy = guyY
  144. FOR y = 1 TO 15
  145. FOR x = 1 TO 21
  146.  
  147. IF map1(x, y) = 1 THEN PUT (x * 15 - 15, y * 13 - 13), sprite1, PSET
  148. IF map1(x, y) = 2 THEN PUT (x * 15 - 15, y * 13 - 13), sprite2, PSET
  149. IF map1(x, y) = 3 THEN PUT (x * 15 - 15, y * 13 - 13), sprite3, PSET
  150. NEXT: NEXT
  151.  
  152. PUT (guyX * 15 - 15, guyY * 13 - 13), guysh, AND
  153. PUT (guyX * 15 - 15, guyY * 13 - 13), guy, OR
  154.  
  155. END IF
  156.  
  157. a% = 0
  158. RANDOMIZE TIMER
  159. a% = INT(RND * 10) + 1
  160. IF a% = 1 THEN xe = xe + 1: IF xe >= 282 THEN xe = xe - 1
  161. IF a% = 2 THEN xe = xe - 1: IF xe <= 14 THEN xe = xe + 1
  162. IF a% = 3 THEN ye = ye + 1: IF ye >= 166 THEN ye = ye - 1
  163. IF a% = 4 THEN ye = ye - 1: IF ye <= 12 THEN ye = ye + 1
  164.  
  165. PUT (xe, ye), enemy, PSET
  166.  
  167. a = RND * 200 + 1000
  168. SOUND a, .1
  169.  
  170. IF xe > (guyX * 15) - 15 AND xe < (guyX * 15) + re AND ye > (guyY * 13) - 26 AND ye < (guyY * 13) + re THEN Battle
  171.  
  172. LOOP UNTIL press$ = CHR$(27)
  173. errline:
  174. RESUME NEXT
  175.  
  176. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  177. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  178. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  179. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  180. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  181. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  182. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  183. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  184. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  185. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  186. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  187. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  188. DATA 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
  189.  
  190.  
  191. 'This (considering its the north pole) will be the snow...
  192.  
  193. DATA 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
  194. DATA 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
  195. DATA 15,15,15,29,29,29,15,15,15,15,15,15,15,15,15
  196. DATA 15,15,29,07,07,07,15,15,15,29,29,15,15,15,15
  197. DATA 15,15,29,07,15,15,15,15,29,07,07,15,15,15,15
  198. DATA 15,29,07,15,15,15,15,29,07,15,15,15,15,15,15
  199. DATA 15,29,15,15,15,15,15,29,07,15,15,15,15,15,15
  200. DATA 15,15,15,15,15,15,29,29,07,15,15,15,15,15,15
  201. DATA 15,15,15,15,15,29,07,07,15,15,15,15,15,15,15
  202. DATA 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
  203. DATA 15,15,15,15,15,15,15,15,15,29,07,15,15,15,15
  204. DATA 15,15,15,15,15,15,15,15,15,15,29,07,07,07,29
  205. DATA 15,15,15,15,15,15,15,15,15,15,15,29,29,29,15
  206.  
  207. 'For the third, floor tiles...
  208.  
  209. DATA 00,00,00,00,00,00,00,02,00,00,00,00,00,00,00
  210. DATA 00,00,00,00,00,02,02,02,02,00,00,00,00,00,00
  211. DATA 00,00,00,00,02,02,02,02,02,02,00,00,00,00,00
  212. DATA 00,00,00,00,00,02,02,02,02,02,00,00,00,00,00
  213. DATA 00,00,00,00,00,00,02,02,02,02,00,00,00,00,00
  214. DATA 00,00,00,00,00,00,00,02,02,00,00,00,00,00,00
  215. DATA 00,00,00,00,00,00,00,06,06,00,00,00,00,00,00
  216. DATA 00,00,00,00,00,00,06,06,00,00,00,00,00,00,00
  217. DATA 00,00,00,00,00,00,06,06,06,00,00,00,00,00,00
  218. DATA 00,00,00,00,00,00,00,06,06,00,00,00,00,00,00
  219. DATA 00,00,00,00,00,00,00,06,06,00,00,00,00,00,00
  220. DATA 00,00,00,00,00,00,06,06,06,00,00,00,00,00,00
  221. DATA 00,00,00,00,00,06,06,06,06,06,00,00,00,00,00
  222.  
  223. 'the map
  224. DATA 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
  225. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  226. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  227. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  228. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  229. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  230. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  231. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  232. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  233. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  234. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  235. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  236. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  237. DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
  238. DATA 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
  239.  
  240.  
  241. 'guy
  242. DATA 00,00,00,00,00,00,00,06,06,06,00,00,00,00,00
  243. DATA 00,00,00,00,00,00,06,06,06,06,06,00,00,00,00
  244. DATA 00,00,00,00,00,02,06,06,06,06,06,02,00,00,00
  245. DATA 00,00,00,00,00,02,02,02,02,02,02,02,00,00,00
  246. DATA 00,00,00,00,00,00,66,00,66,00,66,00,00,00,00
  247. DATA 00,00,00,00,00,00,66,66,66,66,66,00,00,00,00
  248. DATA 00,00,00,00,00,00,00,66,00,66,00,00,00,00,00
  249. DATA 00,00,00,00,00,00,01,01,01,01,01,00,00,00,00
  250. DATA 00,00,00,00,00,01,00,01,01,01,00,01,00,00,00
  251. DATA 00,00,00,00,00,01,00,01,01,01,00,01,00,00,00
  252. DATA 00,00,00,00,00,66,00,01,01,01,00,66,00,00,00
  253. DATA 00,00,00,00,10,00,00,07,00,07,00,00,10,00,00
  254. DATA 00,00,00,00,00,06,06,06,00,06,06,06,00,00,00
  255.  
  256. 'This is the mask for the sprite...
  257.  
  258. DATA 255,255,255,255,255,255,10,0,0,0,255,255,255,255,255
  259. DATA 255,255,255,255,255,10,0,0,0,0,0,255,255,255,255
  260. DATA 255,255,255,10,10,66,0,0,0,0,0,66,255,255,255
  261. DATA 255,255,15,255,255,66,66,66,66,66,66,66,255,255,255
  262. DATA 255,255,255,255,255,255,66,00,66,00,66,255,255,255,255
  263. DATA 255,255,255,255,255,255,66,66,66,66,66,255,255,255,255
  264. DATA 255,255,255,255,255,255,255,66,00,66,255,255,255,255,255
  265. DATA 255,255,255,255,255,255,02,02,02,02,02,255,255,255,255
  266. DATA 255,255,255,255,255,02,255,02,02,02,255,02,255,255,255
  267. DATA 255,255,255,255,255,02,255,02,02,02,255,02,255,255,255
  268. DATA 255,255,255,255,255,66,255,02,02,02,255,66,255,255,255
  269. DATA 255,255,255,255,02,255,255,07,255,07,255,255,02,255,255
  270. DATA 255,255,255,255,255,02,02,02,255,02,02,02,255,255,255
  271.  
  272.  
  273. SUB Battle
  274. CLS ' This battle mode is text-mode-only. For the graphical battle mode then
  275. ' download the full version off: <a rel="nofollow" class="t" href="http://www.sonictomato.com" target="_blank">www.sonictomato.com</a>. Thanks For Playing!
  276.  
  277. LOCATE 22, 2: PRINT "Attack"
  278. LOCATE 24, 2: PRINT "Weaponry"
  279. LOCATE 21, 20: PRINT "Special"
  280. LOCATE 23, 20: PRINT "Run!"
  281. attackmenuoption = 1
  282. DO: Press2$ = INKEY$
  283. IF attackmenuoption = 1 THEN LINE (1, 158)-(75, 168), 7, B: LINE (1, 174)-(75, 185), 0, B: LINE (151, 158)-(221, 168), 0, B: LINE (151, 174)-(221, 185), 0, B
  284. IF attackmenuoption = 2 THEN LINE (1, 174)-(75, 185), 7, B: LINE (1, 158)-(75, 168), 0, B: LINE (151, 158)-(221, 168), 0, B: LINE (151, 174)-(221, 185), 0, B
  285. IF attackmenuoption = 3 THEN LINE (151, 158)-(221, 168), 7, B: LINE (1, 158)-(75, 168), 0, B: LINE (1, 174)-(75, 185), 0, B: LINE (151, 174)-(221, 185), 0, B
  286. IF attackmenuoption = 4 THEN LINE (151, 174)-(221, 185), 7, B: LINE (1, 158)-(75, 168), 0, B: LINE (1, 174)-(75, 185), 0, B: LINE (151, 158)-(221, 168), 0, B
  287.  
  288. IF Press2$ = "w" THEN attackmenuoption = attackmenuoption - 1
  289. IF Press2$ = "s" THEN attackmenuoption = attackmenuoption + 1
  290. IF Press2$ = "a" THEN attackmenuoption = attackmenuoption - 2
  291. IF Press2$ = "d" THEN attackmenuoption = attackmenuoption + 2
  292.  
  293. IF attackmenuoption >= 5 THEN attackmenuoption = 1
  294. IF attackmenuoption <= 0 THEN attackmenuoption = 4
  295.  
  296. LOOP UNTIL Press2$ = CHR$(27)
  297. IF xe < 161 THEN xe = xe + 10
  298. IF xe > 160 THEN xe = xe - 10
  299. END SUB
:eek:

This all took me about a weekend of changing stuff. Also you may find it is similar to another guy's code - Vic Luce? Just getting used to sprites and all that lot. Can't think why :rolleyes:
TP
P.S. View my website with more QBasic stuff @ http://myweb.tiscali.co.uk/fastnet34
Please comment by email to it - thats if you want to.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 445
Reputation: 1o0oBhP is an unknown quantity at this point 
Solved Threads: 6
1o0oBhP's Avatar
1o0oBhP 1o0oBhP is offline Offline
Posting Pro in Training

Re: A little game

 
0
  #2
Jan 1st, 2005
to make it better you could try loading the data from a file, therefore removing the DATA statements...
http://sales.carina-e.com

no www
no nonsense

coming soon to a pc near you! :cool:
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 14
Reputation: Tom Pilk is an unknown quantity at this point 
Solved Threads: 0
Tom Pilk's Avatar
Tom Pilk Tom Pilk is offline Offline
Newbie Poster

Re: A little game

 
0
  #3
Jan 1st, 2005
Do you know how you do that? I hae tried but it doesn't seem to work - i don't know how to read each line of the file...any ideas?
Thanks
TP
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: A little game

 
0
  #4
Jan 1st, 2005
dim tmpvar as string

open "c:\somefile.txt" for input as #1
do until eof(1)
line input #1, tmpvar
DATA tmpvar
loop
close #1

This is assuming you have a file called "c:\somefile.txt" with the numbers in them that will be used for the DATA statement.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC