Wow, that's pretty Beastly, Ashingada, but see if you can beat this!
[edit]
orry, here's the code:
remstart
[--------------------------------]
[ Monster Fight game ]
[ ]
[ (c) 2008 Big Zipper Gaming ]
[ ]
[--------------------------------]
remend
hide mouse
`Init Subroutines
gosub arrays
gosub fill_arrays
gosub variables
gosub player
`[--------------------]
`[ Story ]
`[--------------------]
print "Wake up!"
print "Hurry, we don't have much time!"
print
print "Press any key to continue..."
suspend for key
cls
print "MONSTER FIGHT!"
print
print "Welcome to the town Alzenthale where you must fight for your life..."
print
print "...or be eaten!"
print
print "Press any key to continue..."
suspend for key
cls
input "What is your name, adventurer? ", adventurer_name$
print
print "Welcome to Alzenthale, ";adventurer_name$;"."
print
print "Press any key to continue..."
suspend for key
cls
input "Would you like to see your stats?(yes/no) ", choice$
choice$ = lower$(choice$)
if choice$ = "yes"
gosub display_stats
goto MAIN_LOOP
else
if choice$ = "no"
goto MAIN_LOOP
else
print "That is not a valid choice."
goto MAIN_LOOP
endif
endif
`[--------------------]
`[ MAIN LOOP ]
`[--------------------]
MAIN_LOOP:
cls
gosub home_town_first
do
randomize timer()
cls
gosub morning
gosub check_shopping
gosub fighting
gosub reset_enemy_stats
gosub reset_player_stats
gosub check_if_level_up
loop
`[--------------------]
`[ SUBROUTINES ]
`[--------------------]
`[--------------------]
`[ Init Subroutines ]
`[--------------------]
arrays:
dim enemies$(5,5)
dim stats$(3)
dim places$(2)
dim weapons$(2)
return
fill_arrays:
enemies$(1,1) = "Troll"
enemies$(2,1) = "Goblin"
enemies$(3,1) = "Rat"
enemies$(4,1) = "Orc"
enemies$(5,1) = "Dragon"
enemies$(1,2) = "5"
enemies$(1,3) = "2"
enemies$(1,4) = "15"
enemies$(1,5) = "Stone Fists"
enemies$(2,2) = "7"
enemies$(2,3) = "4"
enemies$(2,4) = "10"
enemies$(2,5) = "Small Knife"
enemies$(3,2) = "2"
enemies$(3,3) = "1"
enemies$(3,4) = "5"
enemies$(3,5) = "Teeth"
enemies$(4,2) = "9"
enemies$(4,3) = "6"
enemies$(4,4) = "20"
enemies$(4,5) = "Short Sword"
stats$(1) = "Attack"
stats$(2) = "Defence"
stats$(3) = "Health"
places$(1) = "Home"
places$(2) = "The Wilderness"
weapons$(1) = "Axe"
weapons$(2) = "Bow"
return
variables:
player_gold = 100
player_potions = 0
player_food = 0
enemy_attack = 5
enemy_defence = 5
enemy_health = 10
enemy_weapon$ = "fists"
return
player:
player_attack$ = "10"
player_defense$ = "5"
player_health$ = "25"
max_player_health = 25
player_weapon$ = "sword"
player_experience = 0
player_level = 1
return
`[--------------------]
`[ Main Subroutines ]
`[--------------------]
display_stats:
print "Your attack is ";player_attack$;"."
print "Your defense is ";player_defense$;"."
print "Your health is ";player_health$;"."
print "Your weapon is ";player_weapon$;"."
print
print "Press any key to continue..."
suspend for key
return
home_town_first:
print "Welcome to Alzenthale."
print "There are many things to do here:"
print "You can train, eat, sleep, and shop for new weapons."
print "But, first, you should get some rest."
print "I'll pay for your first day at the inn, but after that,"
print "You'll have to pay for it yourself."
print
print "Press any key to continue..."
suspend for key
cls
return
morning:
print "Yawn..."
print "What a nice morning."
print
print "Press any key to continue..."
suspend for key
cls
print "[-----STATS-----]"
print "Level: ";player_level
print
print "Experience: ";player_experience
print
print
print "Attack: ";player_attack$
print
print "Defence: ";player_defense$
print
print "Health: ";player_health$
print
print "Money: ";player_gold
print
print "Weapon: ";player_weapon$
print
print
print "Press any key to continue..."
suspend for key
cls
return
check_shopping:
input "Would you like to go shopping today?(yes/no) ",choice$
choice$ = lower$(choice$)
if choice$ = "yes"
gosub shopping
goto end_check_shopping
else
if choice$ = "no"
goto end_check_shopping
else
print "That is not a valid choice."
goto end_check_shopping
endif
endif
end_check_shopping:
print "Press any key to continue..."
suspend for key
cls
return
shopping:
cls
print "Where would you like to shop?"
print
print " (1) Weapon Shop"
print
print " (2) Potion Shop"
print
print " (3) Food Shop"
print
input "Input the number of your selection and press ENTER ", choice
if choice = 1
gosub weapon_shop
goto end_shopping
else
if choice = 2
gosub potion_shop
goto end_shopping
else
if choice = 3
gosub food_shop
goto end_shopping
else
print "That is not a valid choice."
goto end_shopping
endif
endif
endif
end_shopping:
print "Press any key to continue..."
suspend for key
cls
return
weapon_shop:
cls
print "Welcome to the weapon shop!"
print
print "The weapons available are the axe (for 1500 gold) and the bow (for 2000 gold)."
print "You have ";player_gold;" gold."
print
if player_gold < 1500
print "I'm afraid you can't afford either of those weapons."
goto end_weapon_shop
else
endif
print "Which would you like to buy?"
print
print " (1) Axe for 1500 gold"
print
print " (2) Bow for 2000 gold"
print
print " (3) Buy nothing and exit the weapon shop"
print
input "Input the number of your selection and press ENTER ", choice
if choice = 1
print "You have bought the axe."
player_gold = player_gold - 1500
player_weapon$ = "axe"
goto end_weapon_shop
else
if choice = 2
print "You have bought the bow."
player_gold = player_gold - 2000
player_weapon$ = "bow"
else
if choice = 3
goto end_weapon_shop
else
print "That is not a valid choice."
goto end_weapon_shop
endif
endif
endif
end_weapon_shop:
print "Press any key to continue..."
suspend for key
cls
return
potion_shop:
cls
print "Welcome to the potion shop!"
print
print "The potion for sale is health potion (200 gold)"
print "You have ";player_gold;" gold."
print
if player_gold < 200
print "You do not have enough money to afford anything here."
goto end_potion_shop
else
endif
print "Would you like to buy a potion? (yes/no) ", choice$
choice$ = lower$(choice$)
if choice$ = "yes"
print "You have bought a health potion."
player_potions = player_potions + 1
player_gold = player_gold - 200
goto end_potion_shop
else
if choice$ = "no"
goto end_potion_shop
else
print "That is not a valid choice."
goto end_potion_shop
endif
endif
end_potion_shop:
print "Press any key to continue..."
suspend for key
cls
return
food_shop:
cls
print "Welcome to the food shop!"
print
print "The food for sale is meat (50 gold)"
print "You have ";player_gold;" gold."
print
if player_gold < 50
print "You do not have enough money to buy anything here."
goto end_food_shop
else
endif
input "Would you like to buy a meat? (yes/no) ", choice$
choice$ = lower$(choice$)
if choice$ = "yes"
print "You have bought a meat."
player_gold = player_gold - 50
player_food = player_food + 1
goto end_food_shop
else
if choice$ = "no"
goto end_food_shop
else
print "That is not a valid choice."
endif
endif
end_food_shop:
print "Press any key to continue..."
suspend for key
cls
return
fighting:
cls
print "Out to The Wilderness!"
print
wait 2000
print "Encountering an enemy..."
print
print "Press any key to continue..."
suspend for key
enemy = rnd(3)
inc enemy
enemy$ = enemies$(enemy,1)
cls
print "The enemy you've encountered is a ";enemy$
print
print "It's attack is ";enemies$(enemy,2)
print "It's defence is ";enemies$(enemy,3)
print "It's health is ";enemies$(enemy,4)
print "It's weapon is ";enemies$(enemy,5)
print
input "Are you sure you want to engage? (yes/no) ", choice$
print
choice$ = lower$(choice$)
if choice$ = "yes"
goto fighting_loop
else
if choice$ = "no"
print "Experience Deducted"
goto really_end_fighting
else
print "That is not a valid choice."
print "Have fun fighting!"
goto fighting_loop
endif
endif
fighting_loop:
repeat
cls
print "It's attack is ";enemies$(enemy,2)
print "It's defence is ";enemies$(enemy,3)
print "It's health is ";enemies$(enemy,4)
print "It's weapon is ";enemies$(enemy,5)
print
print
print
print
print "Your attack is ";player_attack$;"."
print "Your defense is ";player_defense$;"."
print "Your health is ";player_health$;"."
print "Your weapon is ";player_weapon$;"."
print
print "Press any key to initiate a turn."
print
suspend for key
damage_to_enemy$ = str$(rnd(val(player_attack$)))-str$(rnd(val(enemies$(enemy,3))))
if val(damage_to_enemy$) < 1
damage_to_enemy$ = "0"
endif
enemy_health = val(enemies$(enemy,4)) - val(damage_to_enemy$)
enemies$(enemy,4) = str$(enemy_health)
damage_to_player$ = str$(rnd(val(enemies$(enemy,2))))-str$(rnd(val(player_defence$)))
if val(damage_to_player$) < 1
damage_to_player$ = "0"
endif
player_health = val(player_health$) - val(damage_to_player$)
player_health$ = str$(player_health)
cls
print "You hit a ";damage_to_enemy$
print
print "It hit a ";damage_to_player$
print
print "Press any key to continue..."
suspend for key
until val(enemies$(enemy,4)) < 1 or val(player_health$) < 1
end_fighting:
if val(player_health$) < 1
print "You died."
else
print "Good job!"
gained_experience = rnd(100)
player_experience = player_experience + gained_experience
print "You got ";gained_experience;" experience."
gained_money = rnd(50)
player_gold = player_gold + gained_money
print "You got ";gained_money;" gold."
endif
really_end_fighting:
print "Press any key to continue..."
suspend for key
cls
return
reset_enemy_stats:
enemies$(1,2) = "5"
enemies$(1,3) = "2"
enemies$(1,4) = "15"
enemies$(1,5) = "Stone Fists"
enemies$(2,2) = "7"
enemies$(2,3) = "4"
enemies$(2,4) = "10"
enemies$(2,5) = "Small Knife"
enemies$(3,2) = "2"
enemies$(3,3) = "1"
enemies$(3,4) = "5"
enemies$(3,5) = "Teeth"
enemies$(4,2) = "9"
enemies$(4,3) = "6"
enemies$(4,4) = "20"
enemies$(4,5) = "Short Sword"
return
reset_player_stats:
player_attack$ = "10"
player_defense$ = "5"
player_health$ = "25"
max_player_health = 25
player_weapon$ = "sword"
return
check_if_level_up:
if player_experience > 100
player_experience = player_experience - 100
inc player_level
gained_gold = player_level * 100
player_gold = player_gold + gained_gold
cls
print "You leveled up to level ";player_level;"!"
print "Congratulations!"
print
print "With that, you get ";gained_gold;" gold."
print
print "Press any key to continue..."
suspend for key
cls
endif
return
`[--------------------]
`[ END SUBROUTINES ]
`[--------------------]
And yes, I know there aren't any comments.
~QJ