Well here is my entry.
2-4 players, no computer players.
Didn't make any AI.
Didn't make sound effects.
Didn't use any media.
And didn't put any comments.
I was just joking about not putting any comments
I hope that it works alright, I only tested it on one computer.
`Project: Super Tank Wars
`Author: Webber
Remstart
I programmed a lot more than I thought that I would, around 1000 lines of code for such a simple game
I just wanted to test out my new mouse targeting program. I didn't think that I would ever use it.
I didn't have time to program a help button so here are some things about the game
Game Play / Controls:
Basic controls:
You aim using the mouse, just point towards the enemy
Some weapons are fired by clicking on the mouse
You can change the velocity of certain weapons by using the arrow keys or by moving the z-axis on the mouse
if you press the "r" key it will reset the game. `I used this for testing the game, but you never know if you might want to use it
Weapons:
LITTLE CANNON: fires a projectile in the direction of the turret (Up to 20 damage)
MORTERS: fires a curved projectile based on velocity and the direction of the turret (Up to 20 damage)
REPAIR: recovers 25 health
LASER CANNON: waits one turn to charge, then on your next turn you can fire a powerful laser beam. (50 damage without shields)
SWARMERS fires: a large missile into the air and then bombards the level with 10 random missiles. (Up to 20 damage each)
GUIDED MISSILES: hits each of the other players with missiles causing 30 damage to each of them unless they have shields
OVER SHIELDS: reduces damage by half for up to 8 attacks, (some lucky swarmed missiles are good for taking these out)
SELF DESTRUCT: causes 30 damage to all of the other players while killing yourself; good way to make a draw
(Technically only 6 of those are weapons)
Glitches:
Terrain doesn't seem to work right on the left
Swarmers and Guided missiles cause a temporary funny stretching glitch on the turrets but do not affect the game play
Some of the weapons could have better object collision, but they seem to work alright most of the time
Some of the code could probably be tighter, but the program still works
Some code could be added to make things run faster, such as using sprites for the tanks instead of boxes
To-Do:
I probably need more comments to clear some things up for others
Computer players do not work yet haven't even started, AI can be challenging if you want things to work right
I could add sound effects, but I'm not sure if I'll get to that.
Also I think that the tanks should explode when they get hit, more explosions, maybe some particle effects.
Other then that the game works great, good strategy/luck game
remend
set display mode 640,480,32
set window layout 0,0,0
maximize window
sync on : sync rate 30
randomize timer()
Rem Draw a 32x32 explosion image using dots
lock pixels
for i = 1 to 2048
radius = rnd(15)
angle = rnd(360)
ink rgb(200+rnd(55),255-radius*10,255-radius*16),0
dot cos(angle)*radius+15+rnd(2),sin(angle)*radius+15+rnd(2)
next i
unlock pixels
get image 1,0,0,32,32 `Gets the explosion image
sprite 1,0,0,1 `Creates a sprite out of the image
set sprite 1,0,1 `Makes the sprite have transparency
offset sprite 1,16,16 `Center the sprite
hide sprite 1
Rem Create a transparent sprite for the players weapon select
box 200,120,440,232,RGB(0,0,0),rgb(32,32,32),rgb(32,32,32),rgb(64,64,64)
get image 2,200,120,441,233
sprite 2,0,0,2
set sprite alpha 2,150
hide sprite 2
Rem Create the background
box -1,-1,640,480,RGB(255,192,192),RGB(0,32,48),RGB(255,128,128),RGB(0,16,32)
for i = 1 to 100
dot rnd(640),rnd(480),rgb(rnd(75)+180,rnd(75)+180,rnd(75)+180)
next i
get image 3,0,0,640,480
Rem All of the array data
dim TerrainY(640) `Terrain height
dim PX(3) `Player Starting Positions
dim PlayerX2(3)
dim PlayerY2(3)
dim PlayerAng#(3)
dim PlayerVelocity(3)
dim PlayerMoneys(3)
dim PlayerHealth(3)
dim OverShields(3)
dim LaserArmed(3)
dim PlayerHit(3)
dim MissileHit(9)
dim MissileX(9)
dim Player_Or_Computer(3)
V# as float `Velocity
TurretSize# = 20 `The Length of the tank turrets also the speed of bullets
Reset:
while mouseclick() <> 0 : endwhile
`TTTTT IIIII TTTTT L EEEEE SSSSS CCCCC RRRR EEEEE EEEEE N N
` T I T L E S C R R E E NN N
` T I T L EEEE SSSSS C RRRR EEEE EEEE N N N
` T I T L E S C R R E E N NN
` T IIIII T LLLLL EEEEE SSSSS CCCCC R R EEEEE EEEEE N N
Rem The Title Screen
`starter coloring for rainbowy colors
r = 255
g = 0
b = 0
c = 0
while mouseclick() = 0
box 0,0,640,480,RGB(r,g,b),RGB(r/2,g/2,b/2),RGB(r/2,g/2,b/2),RGB(0,0,0)
set text size 72
`ink rgb(rnd(255),rnd(255),rnd(255)),0 `gives the player a seisure
Rem gets rainbow colors
Gosub GetColors
ink rgb(-r+255,-g+255,-b+255),0
center text 320,150,"SUPER TANK WARS"
set text size 32
center text 320,230,"Webber's Version"
center text 320,360,"Click to Start"
sync
endwhile
while mouseclick() <> 0 : endwhile
`SSSSS EEEEE L EEEEE CCCCC TTTTT SSSSS CCCCC RRRR EEEEE EEEEE N N
`S E L E C T S C R R E E NN N
`SSSSS EEEE L EEEE C T SSSSS C RRRR EEEE EEEE N N N
` S E L E C T S C R R E E N NN
`SSSSS EEEEE LLLLL EEEEE CCCCC T SSSSS CCCCC R R EEEEE EEEEE N N
Rem Computer players don't work yet
Player_Or_Computer(0) = 0
Player_Or_Computer(1) = 0
Player_Or_Computer(2) = 0
Player_Or_Computer(3) = 0
Rem Set up tank variables
for i = 0 to 3
PlayerAng#(i) = rnd(180)+270 `Random turret angles
if PlayerAng#(i) >= 360 then dec PlayerAng#(i),360
PlayerVelocity(i) = 75 `Weapon velocity
PlayerMoneys(i) = 1000 `The Players Moneys
PlayerHealth(i) = 100 `Players health
OverShields(i) = 0
LaserArmed(i) = 0
PlayerHit(i) = 0
next i
do
MX = MouseX() : MY = MouseY() `mouse positions
Rem The 4 player select buttons
Box 0,0,160,320,RGB(255,128,128),RGB(255,0,0),RGB(255,0,0),RGB(128,0,0)
Box 160,0,320,320,RGB(128,255,128),RGB(0,255,0),RGB(0,255,0),RGB(0,128,0)
Box 320,0,480,320,RGB(128,128,255),RGB(0,0,255),RGB(0,0,255),RGB(0,0,128)
Box 480,0,640,320,RGB(192,192,192),RGB(128,128,128),RGB(128,128,128),RGB(64,64,64)
Rem if the mouse is over the player select buttons
if MY >= 0 and MY <= 320
if MX > 0 and MX < 160 then Box 0,0,160,320,RGB(255,192,192),RGB(255,128,128),RGB(255,128,128),RGB(128,64,64)
if MX > 160 and MX < 320 then Box 160,0,320,320,RGB(192,255,192),RGB(128,255,128),RGB(128,255,128),RGB(64,128,64)
if MX > 320 and MX < 480 then Box 320,0,480,320,RGB(192,192,255),RGB(128,128,255),RGB(128,128,255),RGB(64,64,128)
if MX > 480 and MX < 640 then Box 480,0,640,320,RGB(255,255,255),RGB(192,192,192),RGB(192,192,192),RGB(96,96,96)
if mouseclick() = 1 `if the user clicks on one of the buttons
if MX > 0 and MX < 160 then inc PlayerHealth(0),100
if MX > 160 and MX < 320 then inc PlayerHealth(1),100
if MX > 320 and MX < 480 then inc PlayerHealth(2),100
if MX > 480 and MX < 640 then inc PlayerHealth(3),100
for i = 0 to 3
if PlayerHealth(i) = 200 then PlayerHealth(i) = 0
next i
while mouseclick() <> 0 : endwhile
endif
endif
Rem The Quit Button
Box 0,320,320,480,RGB(0,0,0),RGB(128,128,128),RGB(0,0,0),RGB(128,128,128)
if MX > 0 and MX < 320 and MY > 320 and MY < 480
Box 0,320,320,480,RGB(0,0,0),RGB(255,255,255),RGB(0,0,0),RGB(255,255,255)
if mouseclick() = 1 then end
endif
Rem The Play Button
Box 320,320,640,480,RGB(0,0,0),RGB(128,128,128),RGB(0,0,0),RGB(128,128,128)
if MX > 320 and MX < 640 and MY > 320 and MY < 480
Box 320,320,640,480,RGB(0,0,0),RGB(255,255,255),RGB(0,0,0),RGB(255,255,255)
Players = 0
for i = 0 to 3
if PlayerHealth(i) = 100 then inc Players,1
next i
if mouseclick() = 1 and Players >= 2 then exit
endif
Rem Draws all of the text
ink 0,0 `colors the text black
for i = 0 to 3
if PlayerHealth(i) = 100 and Player_Or_Computer(i) = 0 then center text 80+i*160,40,"Player "+str$(i+1)
if PlayerHealth(i) = 0 and Player_Or_Computer(i) = 0 then center text 80+i*160,40,"No Player"
next i
Center text 160,380,"Quit"
Center text 480,380,"Play"
sync
loop
while mouseclick() <> 0 : endwhile
for i = 0 to 9
MissileHit(i) = 1
next i
Rem Create a random terrain using random numbers and a sin wave
Radius = rnd(40)+60
x# = rnd(360)
for i = 1 to 640
x# = x# + rnd(20)/(rnd(10)+7)
TerrainY(i) = 100+Sin(x#)*Radius+Radius
next i
V# = 1.35 `Starting velocity
PlayerNotExist:
PlayerTurn = rnd(3) `Randomizes who gets the first turn
if PlayerHealth(PlayerTurn) = 0 then Goto PlayerNotExist
FiredWeapon = 0
ButtonBox = 1
Explosion = 0
PlayersAlive = 4
Rem Player Starting Positions
PX(0) = 50+rnd(80) : PX(1) = 200+rnd(80)
PX(2) = 420-rnd(80) : PX(3) = 590-rnd(80)
`L OOOOO OOOOO PPPPP
`L O O O O P P
`L O O O O PPPPP
`L O O O O P
`LLLLL OOOOO OOOOO P
do
Rem Mouse Variables
MX = MouseX() : MY = MouseY()
MMZ = MouseMoveZ()
Rem Creates a gradient background
paste image 3,0,0
Rem Draws the terrain using lines
for x = 1 to 640
ink RGB(92,TerrainY(x)/1.2,0),0 `Add colors to the terrain
line x,480,x,-TerrainY(x)+480
next x
`TTTTT AAAAA N N K K L OOOOO OOOOO PPPPP
` T A A NN N K K L O O O O P P
` T AAAAA N N N KKK L O O O O PPPPP
` T A A N NN K K L O O O O P
` T A A N N K K LLLLL OOOOO OOOOO P
Rem Gets Data for all of the players
For DrawPlayer = 0 to 3 `Draws all 4 of the players
PlayerX1 = PX(DrawPlayer) : PlayerY1 = -TerrainY(PlayerX1)+475
Rem Gets an angle for the player based on the mouse positions
If DrawPlayer = PlayerTurn and Player_Or_Computer(DrawPlayer) = 0
PMX# = MX-PlayerX1 : PMY# = MY-PlayerY1 `mouse/player positions
Rem Get the players angle
PAngle# = Atan(PMX#/-PMY#)
Rem adjusts the angle
if PMX# > 0 and PMY# > 0 then dec PAngle#,180
if PMX# < 0 and PMY# > 0 then inc PAngle#,180
Rem fixes more of the angles
if PMX# > 0 and PMY# = 0 then PAngle# = 90
if PMX# = 0 and PMY# > 0 then PAngle# = 180
if PMX# < 0 and PMY# = 0 then PAngle# = 270
endif
if DrawPlayer <> PlayerTurn then PAngle# = PlayerAng#(DrawPlayer)
Rem Point the turret up when fireing weapons 3 or 4
if Weapon > 2 and FiredWeapon = 2 and DrawPlayer = PlayerTurn then PAngle# = 0
Rem Gets the data for the turret
PlayerX2# = PlayerX1+Sin(PAngle#)*TurretSize#
PlayerY2# = PlayerY1-Cos(PAngle#)*TurretSize#
Rem makes the angles easier to read for the game
if PAngle# < 0 then inc PAngle#,360
if PAngle# > 360 then dec PAngle#,360
Rem Calculates the weapons curve
if FiredWeapon = 0
CalculateX1# = PlayerX1 : CalculateY1# = PlayerY1
CalculateX2# = PlayerX2# : CalculateY2# = PlayerY2#
PlayerX2(DrawPlayer) = PlayerX2#
PlayerY2(DrawPlayer) = PlayerY2#
if DrawPlayer = PlayerTurn and PlayerHealth(DrawPlayer) > 0
XSpeed# = Sin(PAngle#)*TurretSize#
YSpeed# = -Cos(PAngle#)*TurretSize#
Rem Adjusts the velocity of the weapon
if MMZ > 0 And V# > 0.15 then Dec V#,0.05
if MMZ < 0 And V# < 5 then inc V#,0.05
if Upkey() = 1 And V# >= 0.150 then Dec V#,0.05
if Downkey() = 1 And V# <= 5.000 then inc V#,0.05
if ButtonBox = 0 and Weapon = 1
Skip = 0
ink rgb(255,255,255),0
for i = 1 to 900
inc Skip,1
if Skip = 2 then Skip = 0
if Skip = 0 then line CalculateX1#,CalculateY1#,CalculateX2#,CalculateY2#
CalculateX1# = CalculateX2#
CalculateY1# = CalculateY2#
CalculateX2# = CalculateX2#+XSpeed#
CalculateY2# = CalculateY2#+YSpeed#
inc YSpeed#,V#
x = CalculateX1#
if x < 640 and x > 0 then if CalculateY1# > -TerrainY(x)+480 then exit
if x > 640 then exit
if x < 0 then exit
next i
endif
PlayerAng#(DrawPlayer) = PAngle#
PlayerVelocity(DrawPlayer) = -V#*20+102
endif
endif
`W W EEEEE AAAAA PPPPP OOOOO N N 1
`W W W E A A P P O O NN N 1
`W W W EEEE AAAAA PPPPP O O N N N 1
`W W W E A A P O O N NN 1
` W W EEEEE A A P OOOOO N N 1
Rem Fire Weapon
if FiredWeapon = 1 and DrawPlayer = PlayerTurn
Rem Colors the Rocket based on the players color
ran = rnd(100) `makes the player get a sick with random flashing colors
if DrawPlayer = 0 then ink rgb(255,ran,ran),0
if DrawPlayer = 1 then ink rgb(ran,255,ran),0
if DrawPlayer = 2 then ink rgb(ran,ran,255),0
if DrawPlayer = 3 then ink rgb(128+ran,128+ran,128+ran),0
if Weapon <> 2
CalculateX3# = CalculateX4#
CalculateY3# = CalculateY4#
endif
if Weapon = 1
CalculateX4# = CalculateX4#+XSpeedFired#
CalculateY4# = CalculateY4#+YSpeedFired#
inc YSpeedFired#,VFired#
endif
if Weapon = 0 `Slow down the bullet for more accurate collision
CalculateX4# = CalculateX4#+XSpeedFired#/2
CalculateY4# = CalculateY4#+YSpeedFired#/2
endif
x = CalculateX3#
if Weapon = 0
if CalculateY3# < 0 or x > 640 or x < 0
FiredWeapon = 0 : TurnOver = 1 : goto TurnNext
endif
endif
if Weapon <> 2
if x < 640 and x > 0 then if CalculateY4# > -TerrainY(x)+480 then FiredWeapon = 0
if x > 640 then if CalculateY4# > -TerrainY(640)+480 then FiredWeapon = 0
if x < 0 then if CalculateY4# > -TerrainY(1)+480 then FiredWeapon = 0
else
if x > 640 or x < 0 or y > 480 or y < 0
LaserArmed(PlayerTurn) = 0
FiredWeapon = 0 : TurnOver = 1 : goto TurnNext
endif
endif
Rem Laser Collision with players and collision with the terrain
if Weapon = 2
for Skip = 1 to 80
CalculateX3# = CalculateX4# : CalculateY3# = CalculateY4#
CalculateX4# = CalculateX4#+XSpeedFired#/40 : CalculateY4# = CalculateY4#+YSpeedFired#/40
x = CalculateX3#
if x <= 640 and x > 0 then if CalculateY4# > -TerrainY(x)+480 then dec TerrainY(x),2
for i = 0 to 3
if x >= PX(i)-15 and CalculateY3# >= -TerrainY(PX(i))+470 and x <= PX(i)+15 and CalculateY3# <= -TerrainY(PX(i))+500
if PlayerHit(i) = 0
if OverShields(i) = 0
dec PlayerHealth(i),50
else
dec OverShields(i),1
dec PlayerHealth(i),25
endif
endif
PlayerHit(i) = 1
if PlayerHealth(i) < 0 then PlayerHealth(i) = 0
endif
next i
next Skip
endif
Rem Draw Bullet
if FiredWeapon = 1 and Weapon < 2
line CalculateX3#,CalculateY3#,CalculateX4#,CalculateY4#
line CalculateX3#+1,CalculateY3#+1,CalculateX4#+1,CalculateY4#+1
endif
Rem Draw Laser
if FiredWeapon = 1 and Weapon = 2
if PlayerTurn = 0 then ink rgb(255,rnd(128)+127,rnd(128)+127),0
if PlayerTurn = 1 then ink rgb(rnd(128)+127,255,rnd(128)+127),0
if PlayerTurn = 2 then ink rgb(rnd(128)+127,rnd(128)+127,255),0
if PlayerTurn = 3 then ink rgb(rnd(128)+127,rnd(128)+127,rnd(128)+127),0
line PlayerX1,PlayerY1,PlayerX1+XSpeed#*100,PlayerY1+YSpeed#*100
line PlayerX1+1,PlayerY1+1,PlayerX1+XSpeed#*100+1,PlayerY1+YSpeed#*100+1
line PlayerX1-1,PlayerY1-1,PlayerX1+XSpeed#*100-1,PlayerY1+YSpeed#*100-1
line PlayerX1+1,PlayerY1+1,PlayerX1+XSpeed#*100-1,PlayerY1+YSpeed#*100-1
line PlayerX1-1,PlayerY1-1,PlayerX1+XSpeed#*100+1,PlayerY1+YSpeed#*100+1
endif
if FiredWeapon = 0 and Weapon <> 2
Rem Puts a hole in the floor
DamageAmount# = 0.75
Damage# = 1
Num1 = CalculateX4#-40
Num2 = CalculateX4#+40
for i = Num1 to Num2
if i > 0 and i < 641
dec DamageAmount#,0.01875
inc Damage#,DamageAmount#
TerrainY(i) = TerrainY(i) - Damage#
if TerrainY(i) < 10 then TerrainY(i) = 10
endif
next i
Explosion = 1
V# = 1.35
endif
endif
`DDDD RRRR AAAAA W W PPPPP L AAAAA Y Y EEEEE RRRR SSSSS
`D D R R A A W W W P P L A A Y Y E R R S
`D D RRRR AAAAA W W W PPPPP L AAAAA Y EEEE RRRR SSSSS
`D D R R A A W W W P L A A Y E R R S
`DDDD R R A A W W P LLLLL A A Y EEEEE R R SSSSS
Rem Draw The Players
if DrawPlayer = 0 then ink rgb(255,0,0),0
if DrawPlayer = 1 then ink rgb(0,255,0),0
if DrawPlayer = 2 then ink rgb(0,0,255),0
if DrawPlayer = 3 then ink rgb(128,128,128),0
if PlayerHealth(DrawPlayer) > 0
for i = 0 to 5
box PlayerX1-i-10,-TerrainY(PlayerX1)+470+i,PlayerX1+i+10,-TerrainY(PlayerX1)+480+i
box PlayerX1-i-15,-TerrainY(PlayerX1)+480-i,PlayerX1+i+15,-TerrainY(PlayerX1)+490-i
next i
endif
Rem Player Text
Set Cursor DrawPlayer*170+15,0
if Player_Or_Computer(DrawPlayer) = 1 then print "Computer";DrawPlayer+1
if Player_Or_Computer(DrawPlayer) = 0 then print "Player";DrawPlayer+1
Set Cursor DrawPlayer*170+15,14
Print "Angle: ";PlayerAng#(DrawPlayer)
Set Cursor DrawPlayer*170+15,28
Print "Velocity: ";PlayerVelocity(DrawPlayer)
Set Cursor DrawPlayer*170+15,42
Print "Moneys: ";PlayerMoneys(DrawPlayer)
Set Cursor DrawPlayer*170+15,56
Print "Health: ";PlayerHealth(DrawPlayer)
Rem OverShields
if OverShields(DrawPlayer) > 0 and PlayerHealth(DrawPlayer) > 0
if rnd(1) = 1
if DrawPlayer = 0 then ink rgb(230,0,0),0
if DrawPlayer = 1 then ink rgb(0,230,0),0
if DrawPlayer = 2 then ink rgb(0,0,230),0
if DrawPlayer = 3 then ink rgb(120,120,120),0
endif
ellipse PlayerX1,-TerrainY(PlayerX1)+480,25,20
endif
Rem Draw the Tanks Tracks
if PlayerHealth(DrawPlayer) > 0
if DrawPlayer = 0 then ink rgb(128,0,0),0
if DrawPlayer = 1 then ink rgb(0,128,0),0
if DrawPlayer = 2 then ink rgb(0,0,128),0
if DrawPlayer = 3 then ink rgb(64,64,64),0
for i = 0 to 3
box PlayerX1+i*10-19,-TerrainY(PlayerX1)+484,PlayerX1+i*10-11,-TerrainY(PlayerX1)+489
box PlayerX1+i*10-17,-TerrainY(PlayerX1)+483,PlayerX1+i*10-13,-TerrainY(PlayerX1)+490
next i
if LaserArmed(DrawPlayer) = 1 and rnd(1) = 1
if DrawPlayer = 0 then ink rgb(128,64,64),0
if DrawPlayer = 1 then ink rgb(64,128,64),0
if DrawPlayer = 2 then ink rgb(64,64,128),0
if DrawPlayer = 3 then ink rgb(96,96,96),0
endif
Rem Draw the turret
for i = -2 to 2
line PlayerX1+i,PlayerY1,PlayerX2(DrawPlayer)+i,PlayerY2(DrawPlayer)
line PlayerX1,PlayerY1+i,PlayerX2(DrawPlayer),PlayerY2(DrawPlayer)+i
next i
endif
Rem Fires a weapon
if mouseclick() = 1 and DrawPlayer = PlayerTurn and FiredWeapon = 0 and ButtonBox = 0 and Weapon <= 2
XSpeedFired# = Sin(PAngle#)*TurretSize#
YSpeedFired# = -Cos(PAngle#)*TurretSize#
CalculateX3# = PlayerX1 : CalculateY3# = PlayerY1
CalculateX4# = PlayerX2# : CalculateY4# = PlayerY2#
VFired# = V#
if Weapon <= 2 then FiredWeapon = 1
`if Weapon = 3 then FiredWeapon = 2
`if Weapon = 4 then FiredWeapon = 3
while mouseclick() = 1 : endwhile
endif
`TTTTT AAAAA N N K K L OOOOO OOOOO PPPPP EEEEE N N DDDD
` T A A NN N K K L O O O O P P E NN N D D
` T AAAAA N N N KKK L O O O O PPPPP EEEE N N N D D
` T A A N NN K K L O O O O P E N NN D D
` T A A N N K K LLLLL OOOOO OOOOO P EEEEE N N DDDD
next DrawPlayer `Done drawing all of the players and the players data and etc stuff
`W W EEEEE AAAAA PPPPP OOOOO N N 22222
`W W W E A A P P O O NN N 2
`W W W EEEE AAAAA PPPPP O O N N N 22222
`W W W E A A P O O N NN 2
` W W EEEEE A A P OOOOO N N 22222
if Weapon > 2 and FiredWeapon = 2
Rem Colors the Rocket based on the players color
ran = rnd(100) `makes the player get a sick with random flashing colors
if PlayerTurn = 0 then ink rgb(255,ran,ran),0
if PlayerTurn = 1 then ink rgb(ran,255,ran),0
if PlayerTurn = 2 then ink rgb(ran,ran,255),0
if PlayerTurn = 3 then ink rgb(128+ran,128+ran,128+ran),0
if BigMissileY => -80
dec BigMissileY,20
line BigMissileX,BigMissileY,BigMissileX,BigMissileY-40
line BigMissileX+2,BigMissileY,BigMissileX+2,BigMissileY-40
line BigMissileX-2,BigMissileY,BigMissileX-2,BigMissileY-40
line BigMissileX+1,BigMissileY-20,BigMissileX+1,BigMissileY-60
line BigMissileX-1,BigMissileY-20,BigMissileX-1,BigMissileY-60
endif
if BigMissileY < -80 and Weapon = 3 `Launch Swarmer Missiles
for i = 0 to 9
NewMissile:
MissileX(i) = rnd(640)
if MissileX(i) > PX(PlayerTurn)-70 and MissileX(i) < PX(PlayerTurn)+70 then goto NewMissile
MissileHit(i) = 0
next i
MissileY = -100
FiredWeapon = 3
endif
if BigMissileY < -80 and Weapon = 4 `Launch Guided Missiles
for i = 0 to 3
MissileHit(i) = 1
if i <> PlayerTurn
MissileHit(i) = 0
if PlayerHealth(i) > 0 then MissileX(i) = PX(i)
if PlayerHealth(i) = 0 then MissileHit(i) = 1
endif
next i
MissileY = -100
FiredWeapon = 3
endif
endif
Rem Swarmers / Guided Missiles
if FiredWeapon = 3
Rem Colors the Rocket based on the players color
ran = rnd(100) `makes the player get a sick with random flashing colors
if PlayerTurn = 0 then ink rgb(255,ran,ran),0
if PlayerTurn = 1 then ink rgb(ran,255,ran),0
if PlayerTurn = 2 then ink rgb(ran,ran,255),0
if PlayerTurn = 3 then ink rgb(128+ran,128+ran,128+ran),0
inc MissileY,20
CheckMissiles = 0
for i = 0 to 9
if MissileY > -TerrainY(MissileX(i))+480 and MissileHit(i) = 0
CalculateX4# = MissileX(i)
DamageAmount# = 0.75 : Damage# = 1
Num1 = CalculateX4#-40
Num2 = CalculateX4#+40
for x = Num1 to Num2
if x > 0 and x < 641
dec DamageAmount#,0.01875
inc Damage#,DamageAmount#
TerrainY(x) = TerrainY(x) - Damage#
if TerrainY(x) < 10 then TerrainY(x) = 10
endif
next x
`EEEEE X X PPPPP L OOOOO SSSSS IIIII OOOOO N N SSSSS
`E X X P P L O O S I O O NN N S
`EEEE X PPPPP L O O SSSSS I O O N N N SSSSS
`E X X P L O O S I O O N NN S
`EEEEE X X P LLLLL OOOOO SSSSS IIIII OOOOO N N SSSSS
Rem Make Explosions from the swarmer missiles / guided missiles
Num = 0
for j = 0 to 3
if PX(j) > CalculateX4#-40 and PX(j) < CalculateX4#+40
if CalculateX4# > PX(j) then Num = CalculateX4#-PX(j)
if CalculateX4# < PX(j) then Num = PX(j)-CalculateX4#
Rem Damage the players that get hit
if OverShields(j) = 0
if Weapon = 3 then dec PlayerHealth(j),20-Num/2
if Weapon = 4 then dec PlayerHealth(j),30
else
dec OverShields(j),1 `damage the players shields
if Weapon = 3 then dec PlayerHealth(j),(20-Num/2)/2
if Weapon = 4 then dec PlayerHealth(j),15
endif
if PlayerHealth(j) < 0 then PlayerHealth(j) = 0
endif
next j
Rem Displays the explosion
if Weapon = 3 then Num = 5
if Weapon = 4 then Num = 10
for j = 1 to Num
ran = rnd(60)
x = CalculateX4#+ran-30
if x < 1 then x = 1
if x > 640 then x = 640
y = -TerrainY(x)+460+rnd(20)
x = CalculateX4#+ran-30
rotate sprite 1,rnd(360)
paste sprite 1,x,y
sync
next j
MissileHit(i) = 1
endif
if MissileHit(i) = 0 then line MissileX(i),MissileY,MissileX(i),MissileY+40
if MissileHit(i) = 1 then inc CheckMissiles,1
next i
Rem Next Players Turn with weapons 3 and 4
if CheckMissiles = 10 `checks if all 10 of the missiles were destroyed
FiredWeapon = 0
CheckMissiles = 0
gosub NextTurn
endif
endif
`EEEEE X X PPPPP L OOOOO SSSSS IIIII OOOOO N N
`E X X P P L O O S I O O NN N
`EEEE X PPPPP L O O SSSSS I O O N N N
`E X X P L O O S I O O N NN
`EEEEE X X P LLLLL OOOOO SSSSS IIIII OOOOO N N
Rem Explosion
if Explosion = 1
Num = 0
for i = 0 to 3
if PX(i) > CalculateX4#-40 and PX(i) < CalculateX4#+40
if CalculateX4# > PX(i) then Num = CalculateX4#-PX(i)
if CalculateX4# < PX(i) then Num = PX(i)-CalculateX4#
Rem Damage the player that gets hit
if OverShields(i) = 0
dec PlayerHealth(i),20-Num/2
else
dec OverShields(i),1 `damages the players shields
dec PlayerHealth(i),(20-Num/2)/2
endif
if PlayerHealth(i) < 0 then PlayerHealth(i) = 0
endif
next i
Rem Displays the explosion
for i = 1 to 15
ran = rnd(60)
x = CalculateX4#+ran-30
if x < 1 then x = 1
if x > 640 then x = 640
y = -TerrainY(x)+460+rnd(20)
x = CalculateX4#+ran-30
rotate sprite 1,rnd(360)
paste sprite 1,x,y
sync
next i
Rem Next Players Turn
gosub NextTurn
Explosion = 0
endif
SelfDestruct:
`SSSSS EEEEE L FFFFF DDDD EEEEE SSSSS TTTTT RRRRR U U CCCCC TTTTT
`S E L F D D E S T R R U U C T
`SSSSS EEEE L FFFFF D D EEEE SSSSS T RRRRR U U C T
` S E L F D D E S T R R U U C T
`SSSSS EEEEE LLLLL F DDDD EEEEE SSSSS T R R UUU CCCCC T
Rem Self Destruct Button
if FiredWeapon = 0
if Explosion = 2
for i = 1 to 100
ran = rnd(640)
x = ran
y = -TerrainY(x)+460+rnd(40)
rotate sprite 1,rnd(360)
paste sprite 1,x,y
if rnd(10) = 0 then sync
next i
Rem Damage the terrain from the self destruct
DamageAmount# = 0.8
Damage# = 1
Num1 = 0
Num2 = 640
for i = Num1 to Num2
if i >= 0 and i < 641
DamageAmount# = DamageAmount# -0.0025
inc Damage#,DamageAmount#
if Damage# < 0 then Damage# = 1
TerrainY(i) = TerrainY(i) - Damage#/1.5
if TerrainY(i) < 10 then TerrainY(i) = 10
endif
next i
Rem Destroy the selfdestructing players tank and damage other tanks
PlayerHealth(PlayerTurn) = 0
Num = PlayerTurn
for i = 1 to 3
inc Num,1
if Num = 4 then Num = 0
if OverShields(Num) = 0
dec PlayerHealth(Num),30
else
dec OverShields(Num),1
dec PlayerHealth(Num),15
endif
if PlayerHealth(Num) < 0 then PlayerHealth(Num) = 0
next i
Explosion = 0
Rem Next Players Turn
gosub NextTurn
endif
endif
`W W EEEEE AAAAA PPPPP OOOOO N N SSSSS EEEEE L EEEEE CCCCC TTTTT
`W W W E A A P P O O NN N S E L E C T
`W W W EEEE AAAAA PPPPP O O N N N SSSSS EEEE L EEEE C T
`W W W E A A P O O N NN S E L E C T
` W W EEEEE A A P OOOOO N N SSSSS EEEEE LLLLL EEEEE CCCCC T
Rem Get colors
if PlayerTurn = 0 then ink rgb(255,0,0),0
if PlayerTurn = 1 then ink rgb(0,255,0),0
if PlayerTurn = 2 then ink rgb(0,0,255),0
if PlayerTurn = 3 then ink rgb(128,128,128),0
Rem Draws the button box
if ButtonBox = 1
paste sprite 2,200,120
rem places lines around the box
line 199,119,441,119 : line 199,233,441,233
line 199,119,199,233 : line 441,119,441,233
endif
Rem Displays whos turn it is
String$ = "Player"+str$(PlayerTurn+1)+"'s Turn"
set text size 32 : Center text 320,80,String$ : set text size 12
Rem Draw weapon select buttons
if ButtonBox = 1
Center text 320,120,"LITTLE CANNON Cost: 0"
Center text 320,134,"MORTER Cost: 50"
Center text 320,148,"REPAIR Cost: 100"
if LaserArmed(PlayerTurn) = 0 then Center text 320,162,"CHARGE LASER CANNON Cost: 200"
if LaserArmed(PlayerTurn) = 1 then Center text 320,162,"FIRE LASER CANNON"
Center text 320,176,"SWARMERS Cost: 300"
Center text 320,190,"GUIDED MISSILES Cost: 400"
Center text 320,204,"OVER SHIELDS Cost: 500"
Center text 320,218,"SELF DESTRUCT Cost: Your life"
if PlayerTurn = 0 then ink rgb(255,128,128),0
if PlayerTurn = 1 then ink rgb(128,255,128),0
if PlayerTurn = 2 then ink rgb(128,128,255),0
if PlayerTurn = 3 then ink rgb(192,192,192),0
for i = 0 to 7
if MX >= 200 and MX <= 440
if MY >= 120+i*14 and MY < 134+i*14
if i = 0 then Center text 320,120,"LITTLE CANNON Cost: 0"
if i = 1 then Center text 320,134,"MORTER Cost: 50"
if i = 2 then Center text 320,148,"REPAIR Cost: 100"
if i = 3 and LaserArmed(PlayerTurn) = 0 then Center text 320,162,"CHARGE LASER CANNON Cost: 200"
if i = 3 and LaserArmed(PlayerTurn) = 1 then Center text 320,162,"FIRE LASER CANNON"
if i = 4 then Center text 320,176,"SWARMERS Cost: 300"
if i = 5 then Center text 320,190,"GUIDED MISSILES Cost: 400"
if i = 6 then Center text 320,204,"OVER SHIELDS Cost: 500"
if i = 7 then Center text 320,218,"SELF DESTRUCT Cost: Your life"
Rem If the player clicks on one of the buttons
if mouseclick() = 1
Rem Little Cannon
if i = 0
FiredWeapon = 0
Weapon = 0
ButtonBox = 0
Explosion = 0
endif
Rem Morter
if i = 1 and PlayerMoneys(PlayerTurn) >= 50
dec PlayerMoneys(PlayerTurn),50
FiredWeapon = 0
Weapon = 1
ButtonBox = 0
Explosion = 0
endif
Rem Repair
if i = 2 and PlayerMoneys(PlayerTurn) >= 100 and PlayerHealth(PlayerTurn) <= 75
dec PlayerMoneys(PlayerTurn),100
inc PlayerHealth(PlayerTurn),25
TurnOver = 1
Goto TurnNext
endif
Rem Charge laser cannon
if i = 3 and LaserArmed(PlayerTurn) = 0 and PlayerMoneys(PlayerTurn) >= 200
dec PlayerMoneys(PlayerTurn),200
LaserArmed(PlayerTurn) = 1
TurnOver = 1
Goto TurnNext
endif
Rem Fire laser cannon
if i = 3 and LaserArmed(PlayerTurn) = 1
FiredWeapon = 0
Weapon = 2
ButtonBox = 0
Explosion = 0
endif
Rem Launch swarmer missiles
if i = 4 and PlayerMoneys(PlayerTurn) >= 300
dec PlayerMoneys(PlayerTurn),300
ButtonBox = 0
Weapon = 3
FiredWeapon = 2
BigMissileX = PX(PlayerTurn)
BigMissileY = -TerrainY(BigMissileX)+480
endif
Rem Launch guided missiles
if i = 5 and PlayerMoneys(PlayerTurn) >= 400
dec PlayerMoneys(PlayerTurn),400
ButtonBox = 0
Weapon = 4
FiredWeapon = 2
BigMissileX = PX(PlayerTurn)
BigMissileY = -TerrainY(BigMissileX)+480
endif
Rem Turn on over shields
if i = 6 and PlayerMoneys(PlayerTurn) >= 500
dec PlayerMoneys(PlayerTurn),500
inc OverShields(PlayerTurn),8
TurnOver = 1
Goto TurnNext
endif
Rem Self Destruct button
if i = 7
ButtonBox = 0
Explosion = 2
FiredWeapon = 0
endif
TurnOver = 0
while mouseclick() = 1 : endwhile
endif
endif
endif
next i
endif
Rem Gets the next turn while jumping out of an area in the program
TurnNext:
if TurnOver = 1
ButtonBox = 0
gosub NextTurn
TurnOver = 0
while mouseclick() = 1 : endwhile
endif
Rem Reset Button
if inkey$() = "r" then goto Reset
sync
loop
`EEEEE N N DDDD
`E NN N D D
`EEEE N N N D D
`E N NN D D
`EEEEE N N DDDD
end
Rem Check for a winner, and get the next players turn
NextTurn:
PlayersDead = 0
for i = 0 to 3
PlayerHit(i) = 0
if PlayerHealth(i) = 0 then inc PlayersDead,1
if PlayerHealth(i) > 0 then Winner = i+1
next i
Rem THE GAME IS A DRAW
if PlayersDead = 4 `The Game was a draw
while mouseclick() = 0
set text size 72
gosub GetColors
box 0,0,640,200,RGB(r,g,b),RGB(0,0,0),RGB(r,g,b),RGB(0,0,0)
box 0,280,640,480,RGB(0,0,0),RGB(r,g,b),RGB(0,0,0),RGB(r,g,b)
ink rgb(-r+255,-g+255,-b+255),0
box 0,200,640,281
ink rgb(r,g,b),0
center text 320,200,"YOU ALL LOSE"
sync
endwhile
goto Reset `goes back to the title screen
endif
Rem Gets the next players turn
NotYourTurn:
inc PlayerTurn,1
if PlayerTurn = 4 then PlayerTurn = 0
if PlayerHealth(PlayerTurn) = 0 then goto NotYourTurn
Rem THE WINNER SCREEN
if PlayersDead = 3 `if there is only one player left
while mouseclick() = 0 `waits for the player to click on the mouse
Rem Colors the background differently depending on who won
if Winner = 1
box 0,0,640,200,RGB(255,0,0),RGB(0,0,0),RGB(255,0,0),RGB(0,0,0)
box 0,280,640,480,RGB(0,0,0),RGB(255,0,0),RGB(0,0,0),RGB(255,0,0)
endif
if Winner = 2
box 0,0,640,200,RGB(0,255,0),RGB(0,0,0),RGB(0,255,0),RGB(0,0,0)
box 0,280,640,480,RGB(0,0,0),RGB(0,255,0),RGB(0,0,0),RGB(0,255,0)
endif
if Winner = 3
box 0,0,640,200,RGB(0,0,255),RGB(0,0,0),RGB(0,0,255),RGB(0,0,0)
box 0,280,640,480,RGB(0,0,0),RGB(0,0,255),RGB(0,0,0),RGB(0,0,255)
endif
if Winner = 4
box 0,0,640,200,RGB(255,255,255),RGB(0,0,0),RGB(255,255,255),RGB(0,0,0)
box 0,280,640,480,RGB(0,0,0),RGB(255,255,255),RGB(0,0,0),RGB(255,255,255)
endif
gosub GetColors `gets rainbow colors
ink rgb(-r+255,-g+255,-b+255),0 `the color of the box in the center
box 0,200,640,281
ink rgb(r,g,b),0 `The color of the text
set text size 72
center text 320,200,"Player "+Str$(Winner)+" WINS"
sync
endwhile
goto Reset `Goes back to title screen
endif
ButtonBox = 1 `Weapon select
return
Rem Gets rainbow colors
GetColors:
for skip = 1 to 5 `adjust the speed of the color changing
if g = 255 and c = 0 then c = 1
if r = 0 and c = 1 then c = 2
if b = 255 and c = 2 then c = 3
if g = 0 and c = 3 then c = 4
if r = 255 and c = 4 then c = 5
if b = 0 and c = 5 then c = 0
if c = 0 then g = g + 1
if c = 1 then r = r - 1
if c = 2 then b = b + 1
if c = 3 then g = g - 1
if c = 4 then r = r + 1
if c = 5 then b = b - 1
next skip
Return
I hope that you like it.
I like games, and stuff.