flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > simple physics game |
Author |
|
Akujin 17 Oct 2011, 09:41
Lets make an asm port...
_________________ CLI HLT |
|||
17 Oct 2011, 09:41 |
|
me239 17 Oct 2011, 20:45
Akujin wrote: Lets make an asm port... |
|||
17 Oct 2011, 20:45 |
|
Akujin 17 Oct 2011, 20:55
Almost done!
http://board.flatassembler.net/topic.php?t=13505 _________________ CLI HLT |
|||
17 Oct 2011, 20:55 |
|
me239 22 Oct 2011, 21:32
Hey! So I made some quick hack job graphics for my QB game. The tank is now a blue box and it graphs the parabolic path of the projectile.
Code: SCREEN 9 WINDOW (-30, -200)-(2200, 1000) LINE (0, -200)-(0, 1000) LINE (-30, 0)-(2200, 0) RANDOMIZE TIMER r = INT(RND * 2050) + 1 PSET ((r / 2), 1), 3 DRAW "l5 u5 r15 d5 l15" PRINT "ALERT! Tank spotted"; r; "meters away" PRINT "You have 3 shell types: " PRINT "Short range: 50 m/s and 255 meter max" PRINT "Medium range: 100 m/s 1,020 meter max" PRINT "Long range: 200 m/s 4,081 meter max" INPUT "(S)hort range, (M)edium range, or (L)ong range"; c$ IF c$ = "s" OR c$ = "S" THEN v = 50 IF c$ = "m" OR c$ = "M" THEN v = 100 IF c$ = "l" OR c$ = "L" THEN v = 200 INPUT "Launch angle: "; a a = a / (180 / (22 / 7)) ha = COS(a) * v va = SIN(a) * v FOR x = 0 TO 60 STEP .0002 y = (va - (9.8 * x)) * x h = (ha * x) IF y < 0 THEN GOTO done PSET (h, y), 4 NEXT x done: t = (va / 9.8) * 2 d = ha * t IF d > r + 10 THEN GOTO miss IF d < r - 10 THEN GOTO miss PRINT "HIT! Enemy tank has been destroyed!" PRINT "Distance: "; d PRINT "Time: "; t WHILE INKEY$ = "" WEND END miss: PRINT "MISS! The enemy tank has shot AND killed you " PRINT "Distance: "; d PRINT "Time: "; t WHILE INKEY$ = "" WEND
|
|||||||||||||||||||
22 Oct 2011, 21:32 |
|
me239 23 Oct 2011, 01:29
Yet another update. I've changed the range so it's more realistic (1 - 4 Km), changed the speeds to 100, 150, and 200 m/s, and also two little secret options. "G" automatically finds the fastest route and "GA" finds the longest path.
Code: SCREEN 9 WINDOW (-30, -200)-(2200, 1000) LINE (0, -200)-(0, 1000) LINE (-30, 0)-(2200, 0) RANDOMIZE TIMER r = INT((RND + .25) * 3250) PSET ((r / 2), 1), 3 DRAW "l5 u5 r15 d5 l15" PRINT "ALERT! Tank spotted"; r; "meters away" PRINT "You have 3 shell types: " PRINT "Short range: 100 m/s and 1,020 meter max" PRINT "Medium range: 150 m/s 2,296 meter max" PRINT "Long range: 200 m/s 4,081 meter max" INPUT "(S)hort range, (M)edium range, or (L)ong range"; c$ IF c$ = "s" OR c$ = "S" THEN v = 100 IF c$ = "m" OR c$ = "M" THEN v = 150 IF c$ = "l" OR c$ = "L" THEN v = 200 IF c$ = "g" OR c$ = "G" THEN GOTO calc IF c$ = "ga" OR c$ = "GA" OR c$ = "Ga" OR c$ = "gA" THEN GOTO calc INPUT "Launch angle: "; a a = a / (180 / (22 / 7)) game: ha = COS(a) * v va = SIN(a) * v FOR x = 0 TO 60 STEP .0002 y = (va - (9.8 * x)) * x h = (ha * x) IF y < 0 THEN GOTO done PSET (h, y), 4 NEXT x done: t = (va / 9.8) * 2 d = ha * t 'd = d + (ha * .494) IF d > r + 10 THEN GOTO miss IF d < r - 10 THEN GOTO miss PRINT "HIT! Enemy tank has been destroyed!" PRINT "Distance: "; d PRINT "Time: "; t WHILE INKEY$ = "" WEND END miss: PRINT "MISS! The enemy tank has shot AND killed you " PRINT "Distance: "; d PRINT "Time: "; t WHILE INKEY$ = "" WEND END calc: IF r <= 1020 THEN v = 100 IF r <= 2296 THEN v = 150 IF r <= 4081 THEN v = 200 a = (r * 9.8) a = a / v ^ 2 a = ATN(a / SQR(-a * a + 1)) / 2 IF c$ = "ga" OR c$ = "GA" OR c$ = "Ga" OR c$ = "gA" THEN a = 1.5707963267# - a GOTO game |
|||
23 Oct 2011, 01:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.