TGC Codebase Backup



Text Battles by Alex Libby

19th Dec 2009 19:17
Summary

This is a text based game, but it's fun to play.



Description

This game will give you sum helpful information on debuging your code.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    rem Copyright information
print "--------------------------"
print "Text Battles v1.0 (2009)  "
print "By: Alexander Brooks Libby":ABL=1
print "--------------------------"
sleep 3000
cls

rem Value setup.
_start:
Bug$="None"
Turn=0
Life1=100
Life2=100

rem Setting up user 2.
while User2>2 or User2<=0
print "--------------------------------------"
input "Play With The Cpu(1) or a Friend(2) : ",User2
cls
endwhile

rem Starting the main loop.
while Bug$="None"
Turn=Turn+1
Defense1=0
Defense2=0
Weapon1=0
Weapon2=0

rem Setting the user 1 name.
_Name1set:
if Name1set=0
print "---------------"
input "Player1 name : ",Name1$
cls
if len(Name1$)>15 then goto _Name1set:
if len(Name1$)=0 then Name1$=GET USER NAME$()
Name1set=1
endif

rem Getting user 1 defense input.
while Defense1>3 or Defense1<=0
print Name1$
print "------------------------------------------------------------"
input "defense; (1)BlastArmor, (2)BulletProofVest, (3)RiotShield : ",Defense1
cls
endwhile

rem Getting user 1 weapon input.
while Weapon2>3 or Weapon2<=0
print Name1$
print "--------------------------------------"
input "weapon; (1)Grenade, (2)Gun, (3)Kife : ",Weapon2
cls
endwhile

rem Setting computer name.
if User2=1
if Name2set=0
Name2$=GET COMPUTER NAME$()
Name2set=1
endif

rem Getting computer input.
while Defense2=0
Defense2=rnd(3)
endwhile
while Weapon1=0
Weapon1=rnd(3)
endwhile
endif

rem Setting the user 2 name.
if User2=2
_Name2set:
if Name2set=0
print "---------------"
input "Player2 name : ",Name2$
cls
if len(Name2$)>15 or len(Name2$)=0
goto _Name2set:
endif
Name2set=1
endif

rem Getting user 2 defense input.
while Defense2>3 or Defense2<=0
print Name2$
print "-------------------------------------------------------------"
input " defense; (1)BlastArmor, (2)BulletProofVest, (3)RiotShield : ",Defense2
cls
endwhile

rem Getting user 2 weapon input.
while Weapon1>3 or Weapon1<=0
print Name2$
print "---------------------------------------"
input " weapon; (1)Grenade, (2)Gun, (3)Kife : ",Weapon1
cls
endwhile
cls
endif

rem Setting player 1 dafalt weapon damage.
Grenade1=100
Gun1=66
Kife1=33

rem Adding player 1 defensive move.
if Defense1=1
Grenade1=Grenade1*.10
Gun1=Gun1*.66
endif
if Defense1=2
Gun1=Gun1*.10
Kife1=Kife1*.66
endif
if Defense1=3
Grenade1=Grenade1*.66
Kife1=Kife1*.10
endif

rem Setting player 2 weapon affects.
GrenadeRnd1=Rnd(Grenade1)
GunRnd1=Rnd(Gun1)
KifeRnd1=Rnd(Kife1)

rem Damaging player 2.
if Weapon1=1 then Life1=Life1-GrenadeRnd1
if Weapon1=2 then Life1=Life1-GunRnd1
if Weapon1=3 then Life1=Life1-KifeRnd1

rem Setting player 2 dafalt weapon damage.
Grenade2=100
Gun2=66
Kife2=33

rem Adding player 1 defensive move.
if Defense2=1
Grenade2=Grenade2*.10
Gun2=Gun2*.66
endif
if Defense2=2
Gun2=Gun2*.10
Kife2=Kife2*.66
endif
if Defense2=3
Grenade2=Grenade2*.66
Kife2=Kife2*.10
endif

rem Setting player 1 weapon affects.
GrenadeRnd2=Rnd(Grenade2)
GunRnd2=Rnd(Gun2)
KifeRnd2=Rnd(Kife2)

rem Damaging player 1.
if Weapon2=1 then Life2=Life2-GrenadeRnd2
if Weapon2=2 then Life2=Life2-GunRnd2
if Weapon2=3 then Life2=Life2-KifeRnd2

rem Print number of attacks.
print "---------------------------------------------------"
print "Attack number : ",Turn
print "---------------------------------------------------"
print

rem Print players remaining life.
print "Player Life:"
print "---------------------------------------------------"
print Name1$," : ",Life1,"%"
print Name2$," : ",Life2,"%"
print

rem Print player 1 information.
print Name1$," Used:"
print "---------------------------------------------------"
if Defense1=1 then print "Blast Armor"
if Defense1=2 then print "Bullet ProofVest"
if Defense1=3 then print "Riot Shield"
if Weapon2=1 then print "Grenade : ",GrenadeRnd2
if Weapon2=2 then print "Gun : ",GunRnd2
if Weapon2=3 then print "Kife : ",KifeRnd2
print

rem Print player 2 information.
print Name2$," Used:"
print "---------------------------------------------------"
if Defense2=1 then print "Blast Armor"
if Defense2=2 then print "Bullet ProofVest"
if Defense2=3 then print "Riot Shield"
if Weapon1=1 then print "Grenade : ",GrenadeRnd1
if Weapon1=2 then print "Gun : ",GunRnd1
if Weapon1=3 then print "Kife : ",KifeRnd1
print

rem Print player 1 and 2 lost game information.
if Life1<=0 and Life2<=0
print "---------------------------------------------------"
print "   Game Over, ",Name1$," and ",Name2$," You Tied!"
print "---------------------------------------------------"
restart()
endif

rem Print player 1 lost game information.
if Life1<=0
print "--------------------------------------"
print "   Game Over, ",Name1$," You Lose!"
print "--------------------------------------"
restart()
endif

rem Print player 2 lost game information.
if Life2<=0
print "--------------------------------------"
print "   Game Over, ",Name2$," You Lose!"
print "--------------------------------------"
restart()
endif

rem Looking for bugs.
if Name1$="test" then Bug$="test"
if ABL<=0 or ABL>1 then Bug$="ABL"
if Turn<=0 or Turn>15 then Bug$="Turn"
if Name1set<=0 or Name1set>1 then Bug$="Name1set"
if Name2set<=0 or Name2set>1 then Bug$="Name2set"
if len(Name1$)>15 or len(Name1$)=0 then Bug$="Name1"
if len(Name2$)>15 or len(Name2$)=0 then Bug$="Name2"
if Life1>100 or Life1<=-100 then Bug$="Life1"
if Life2>100 or Life2<=-100 then Bug$="Life2"
if User2>2 or User2<=0 then Bug$="User2"
if Defense1>3 or Defense1<=0 then Bug$="Defense1"
if Defense2>3 or Defense2<=0 then Bug$="Defense2"
if Weapon1>3 or Weapon1<=0 then Bug$="Weapon1"
if Weapon2>3 or Weapon2<=0 then Bug$="Weapon2"
if Grenade1>100 or Grenade1<=0 then Bug$="Grenade1"
if Gun1>100 or Gun1<=0 then Bug$="Gun1"
if Kife1>100 or Kife1<=0 then Bug$="Kife1"
if Grenade2>100 or Grenade2<=0 then Bug$="Grenade2"
if Gun2>100 or Gun2<=0 then Bug$="Gun2"
if Kife2>100 or Kife2<=0 then Bug$="Kife2"
if GrenadeRnd1>100 or GrenadeRnd1<0 then Bug$="GrenadeRnd1"
if GunRnd1>100 or GunRnd1<0 then Bug$="GunRnd1"
if KifeRnd1>100 or KifeRnd1<0 then Bug$="KifeRnd1"
if GrenadeRnd2>100 or GrenadeRnd2<0 then Bug$="GrenadeRnd2"
if GunRnd2>100 or GunRnd2<0 then Bug$="GunRnd2"
if KifeRnd2>100 or KifeRnd2<0 then Bug$="KifeRnd2"
sleep 1000
print "Press any key to continue . . ."
wait key
cls
endwhile

rem Get help message.
if Bug$="test" then goto _list:
cls
print "---------------------------------"
print "  please get an administrator.   "
print "---------------------------------"
print
sleep 1000
print "Press any key to continue . . ."
wait key

rem Full bug report.
_list:
cls
print
print "   Bug Name : ",Bug$
Print "        ABL : ",ABL
print "      User2 : ",User2
print "       Turn : ",Turn
print "   Name1set : ",Name1set
print "   Name2set : ",Name2set
print "      Name1 : ",Name1$
print "      Name2 : ",Name2$
print "      Life1 : ",Life1
print "      Life2 : ",Life2
print "   Defense1 : ",Defense2
print "   Defense2 : ",Defense2
print "    Weapon1 : ",Weapon1
print "    Weapon2 : ",Weapon2
print "   Grenade1 : ",Grenade1
print "       Gun1 : ",Gun1
print "      Kife1 : ",Kife1
print "   Grenade2 : ",Grenade2
print "       Gun2 : ",Gun2
print "      Kife2 : ",Kife2
print "GrenadeRnd1 : ",GrenadeRnd1
print "GrenadeRnd2 : ",GrenadeRnd2
print "    GunRnd1 : ",GunRnd1
print "    GunRnd2 : ",GunRnd2
print "   KifeRnd1 : ",KifeRnd1
print "   KifeRnd2 : ",KifeRnd2
restart()
end

Function restart():rem Game reset or exit.
print
sleep 1000
print "Press any key to continue . . ."
wait key
cls
While Again<=0 or Again=>3
input "play again (1)yes, (2)no : ",Again
cls
endwhile
if Again = 1 then goto _start:
if Again = 2 then end
Endfunction Again