I want to have a game with multiple dungeon levels. I also want to have it randomly select monsters the player has to fight, but i want different percent chances of having to fight easy, medium, or hard monsters based on character level. My code below is not an actual game but is made to demonstrate loading monster data
in a game. Is there a more efficient way to do this than my code below?
sync on : sync rate 30
set display mode 800,600,32
randomize timer()
PlayerLevel = 3
dim monsters$(1)
Random = rnd(99) + 1
rem determine monster class and read in monster list for that class
ClassChance = Random / PlayerLevel
if ClassChance < 15
restore DlvlOneMedium:
for i = 0 to 1
read monsters$(i)
next i
else
restore DlvlOneEasy:
for i = 0 to 1
read monsters$(i)
next i
endif
rem determine the monster the player will fight
monster$ = monsters$(rnd(1))
rem print monster name
print monster$
sync
rem load monster info/stats and print them
if monster$ = "newt"
restore newt:
read monA : read monB : read monC : read monD
print monA : print monB : print monC : print monD
endif
rem load monster info/stats and print them
if monster$ = "bat"
restore bat:
read monA : read monB : read monC : read monD
print monA : print monB : print monC : print monD
endif
rem load monster info/stats and print them
if monster$ = "orc"
restore orc:
read monA : read monB : read monC : read monD
print monA : print monB : print monC : print monD
endif
rem load monster info/stats and print them
if monster$ = "zombie"
restore zombie:
read monA : read monB : read monC : read monD
print monA : print monB : print monC : print monD
endif
sync
wait key
DlvlOneEasy:
data "newt","bat"
DlvlOneMedium:
data "orc","zombie"
orc:
data 1,2,3,4
zombie:
data 5,6,7,8
newt:
data 9,10,11,12
bat:
data 13,14,15,16