Post by asmodeus on Oct 12, 2010 13:50:31 GMT -5
Hi All, I've been awhile for awhile but am back and wanted to post the ASCII RPG game I have been working on. Please feel free to comment or report bugs.
-Asmodeus
'---------------------------------------------------------------------
'Start Intro for Game
'Dim Texture : Texture = LoadTexture("Lucida_Console.png")
'Font(Texture)
'dim h$, a$, s$, ar$, v$, i
'dim h1, h2, a1, a2, s1, s2, ar1, ar2, v1, v2
'h1 = 10
'h2 = 10
'a1 = 15
'a2 = 10
's1 = 19
's2 = 10
'ar1 = 25
'ar2 = 10
'v1 = 14
'v2 = 12
'h$ = "Hack"
'a$ = "and"
's$ = "Slash"
'ar$ = "Arena"
'v$ = "Version 1.0"
'for i = 1 to 20 : color (rnd()%255, rnd()%255, rnd()%255): print chr$(rnd()%255)
'cls
'locate h1, h2 : print h$
'locate a1, a2 : print a$
'locate s1, s2 : print s$
'locate ar1, ar2 : print ar$
'locate v1, v2 : print v$
'sleep (100)
'next
'End of Intro
'---------------------------------------------------------------------
'---------------------------------------------------------------------
'Start of Dim Variables for Game
cls
color(255,255,100)
textmode(text_buffered)
dim a,b,c$,d,e,f$,aa,bb,cc$
dim px, py, ac, hp, maxhp, dmg, dmg$, xp, acx, acy, hpx, hpy, dmgx, dmgy, xpx, xpy, gold, goldx, goldy
dim name$, namex, namey, level, levelx, levely
dim innmenu$, armormenu$, weaponmenu$, trainingmenu$, help$ 'Menu Variables
dim weapon$, weaponx, weapony, armor$, armorx, armory
dim mon1x, mon1y 'Monster 1 Location X, Y
dim monstertype$, montypex, montypey 'Display Monster Type and Location X, Y
dim ln 'Load/New Game Variable
px = 20 'Player Location X
py = 8 'Player Location Y
ac = 1 'Armor Class Variable
hp = 10 'Hitpoint Variable
maxhp = 10 'Max Hitpoint Variable
dmg$ = "1-2" 'Damage Display
dmg = rnd() % 2 + 1 'Damage Variable
xp = 0 'Experience Variable
level = 1 'Level Variable
gold = 10000 'Gold Variable
namex = 1 'Name Location X
namey = 2 'Name Location Y
acx = 1 'Armor Class Location X
acy = 3 'Armor Class Location Y
hpx = 1 'Hitpoint Location X
hpy = 4 'Hitpoint Location Y
dmgx = 1 'Damage Location X
dmgy = 5 'Damage Location Y
xpx = 1 'Experience Location X
xpy = 6 'Experience Location Y
levelx = 1 'Level Location X
levely =7 'Level Location Y
goldx = 1 'Gold Location X
goldy = 8 'Gold Location Y
weaponx = 1 'Weapon Name Location X
weapony = 12 'Weapon Name Location Y
weapon$ = "None" 'Weapon Default Value
armor$ = "None" 'Armor Default Value
armorx = 1 'Armor Name Location X
armory = 13 'Armor Name Location Y
mon1x = 25 'Monster 1 Location X
mon1y = 10 'Monster 1 Location Y
'End of Dim Variables
'---------------------------------------------------------------------
'---------------------------------------------------------------------
'Load/New Game Settings
printr " [1] Load Game";
printr " [2] New Game";
printr
input "Enter Selection: "; ln
if ln = 1 then
endif
if ln = 2 then cls : input "Enter Character Name: "; name$ : endif
'End of Load/New Game Settings
'---------------------------------------------------------------------
'---------------------------------------------------------------------
'Start of Town Map
dim arena$(23,39) ' Arena Map
dim map$(23,39) 'Town Map
town:
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," ","@","@","@"," "," "," "," ","@","@","@","@"," "," "," "," ","@","@","@","@"," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," ","@","1","@"," "," "," "," ","@","2","@","@"," "," "," "," ","@","@","3","@"," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," ","@","4","@"," "," "," "," "," "," "," "," "," "," ","@","@","5","@","@"," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," ","@","@","@"," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@"," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@"," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@"," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@"," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@"," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
for a = 0 to 23
for b = 0 to 39
read c$
map$(a,b) = c$
next
next
gosub draw
'End of Town Map
'---------------------------------------------------------------------
'---------------------------------------------------------------------
'Draw Subroutine for town map
draw:
cls
for a = 0 to 23
for b = 0 to 39
locate b,a
print map$(a,b)
if a=py and b=px then locate b,a: print "M": endif
next
next
locate namex, namey: print "Name = "; name$
locate acx, acy: print "AC = "; ac
locate hpx, hpy: print "HP = "; hp
locate dmgx, dmgy: print "DMG = "; dmg$
locate xpx, xpy: print "XP = "; xp
locate levelx, levely: print "Level = "; level
locate goldx, goldy: print "Gold = "; gold
locate 1, 10 : print "Equipped:"
locate weaponx, weapony: print weapon$
locate armorx, armory: print armor$
locate 1, 23: print "Press 9 to display Help Info"
drawtext ()
sleep (75) 'Controls Movement Speed
'End of Draw Subroutine
'---------------------------------------------------------------------
'---------------------------------------------------------------------
'Input Keys
while true
if ScanKeyDown(VK_UP) and map$(py-1,px) <> "@" then py = py - 1 : gosub draw : endif
if ScanKeyDown(VK_UP) and map$(py,px) = "1" then goto inn : endif
if ScanKeyDown(VK_UP) and map$(py,px) = "2" then goto weapon : endif
if ScanKeyDown(VK_UP) and map$(py,px) = "3" then goto armor : endif
if ScanKeyDown(VK_DOWN) and map$(py+1,px) <> "@" then py = py + 1 : gosub draw : endif
if ScanKeyDown(VK_DOWN) and map$(py,px) = "4" then goto training : endif
if ScanKeyDown(VK_DOWN) and map$(py,px) = "5" then goto arena : endif
if ScanKeyDown(VK_LEFT) and map$(py,px-1) <> "@" then px = px - 1 : gosub draw : endif
if ScanKeyDown(VK_RIGHT) and map$(py,px+1) <> "@" then px = px + 1 : gosub draw : endif
if KeyDown ("9") then gosub help : endif
wend
'End of Input Keys
'---------------------------------------------------------------------
'---------------------------------------------------------------------
'Subroutines for Locations
inn:
cls
reset town
printr "Illian's Inn"
printr
printr "[1] Rest [Restores HP]"
printr "[2] Back to town"
printr
input "Enter Selection: "; innmenu$
if innmenu$ = 1 then
cls : print "You feel refreshed"; : drawtext() : sleep (1000)
endif
if innmenu$ = 2 then goto town : endif
drawtext()
goto inn
weapon:
cls
reset town
printr "Wilhelm's Weapons"
printr
printr "[1] Dagger [DMG = 1-4 - $50]"
printr "[2] Longsword [DMG = 1-8 - $500]"
printr "[3] Mace of Frost [DMG = 1-12 - $1500]"
printr
printr "[4] Back to town"
printr
input "Enter Selection: "; weaponmenu$
if weaponmenu$ = 1 and gold >= 50 then weapon$ = "Dagger" : dmg$ = "1-4" : gold = gold - 50 : endif
if weaponmenu$ = 2 and gold >= 500 then weapon$ = "Longsword" : dmg$ = "1-8" : gold = gold - 500 : endif
if weaponmenu$ = 3 and gold >= 1500 then weapon$ = "Mace of Frost" : dmg$ = "1-12" : gold = gold - 1500 : endif
if weaponmenu$ = 4 then goto town : endif
drawtext()
goto town
armor:
cls
reset town
printr "Angr's Armor"
printr
printr "[1] Leather Armor [+2 AC - $100]"
printr "[2] Chainmail [+5 AC - $1000]"
printr "[3] Platemail [+9 AC - $2500]"
printr
printr "[4] Back to town"
printr
input "Enter Selection: "; armormenu$
if armormenu$ = 1 then armor$ = "Leather" : ac = ac + 2 : gold = gold - 100 : endif
if armormenu$ = 2 then armor$ = "Chainmail" : ac = ac + 5 : gold = gold - 1000 : endif
if armormenu$ = 3 then armor$ = "Platemail" : ac = ac + 9 : gold = gold - 2500 : endif
if armormenu$ = 4 then goto town : endif
drawtext()
goto town
training:
cls
reset town
printr "Titan's Training"
printr
printr "[1] Level Up Experience Table:"
printr
printr " Level 2 Needs 1000xp"
printr " Level 3 Needs 2000xp"
printr " Level 4 Needs 3000xp"
printr " Level 5 Needs 4000xp"
printr
printr "[4] Back to town"
printr
input "Enter Selection: "; armormenu$
if armormenu$ = 1 then armor$ = "Leather Armor"
ac = ac + 2
gold = gold - 100
endif
if armormenu$ = 4 then goto town : endif
drawtext()
goto town
'End of Subroutines for Locations
'---------------------------------------------------------------------
'---------------------------------------------------------------------
'Arena Setup
arena:
cls
reset arena
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","A","R","E","N","A"," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," ","@","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@"," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," ","@","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@"," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," ","@","@","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@"," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@"," "," "," ","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@","@"," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
data " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
for aa = 0 to 23
for bb = 0 to 39
read cc$
arena$(aa,bb) = cc$
next
next
draw2:
for aa = 0 to 23
for bb = 0 to 39
locate bb,aa
print arena$(aa,bb)
if aa=py and bb=px then locate bb,aa: print "M": endif
locate 1, 23: print "Press 0 to Exit Arena";
next
next
locate namex, namey: print "Name = "; name$
locate acx, acy: print "AC = "; ac
locate hpx, hpy: print "HP = "; hp
locate dmgx, dmgy: print "DMG = "; dmg$
locate xpx, xpy: print "XP = "; xp
locate levelx, levely: print "Level = "; level
locate goldx, goldy: print "Gold = "; gold
locate weaponx, weapony: print weapon$
locate armorx, armory: print armor$
locate mon1x, mon1y: print "B"
'-----------------------------------------------------------------
'Monster Movement
'-----------------------------------------------------------------
if mon1x < px and arena$(mon1y,mon1x) <> "@" then
mon1x = mon1x + 1
else
mon1x = mon1x - 1
endif
if mon1y < py and arena$(mon1y,mon1x) <> "@" then
mon1y = mon1y + 1
else
mon1y = mon1y - 1
endif
'-----------------------------------------------------------------
'End Monster Movement
'-----------------------------------------------------------------
drawtext()
sleep (75) 'Controls Movement Speed
reset town
while true
if ScanKeyDown(VK_UP) and arena$(py-1,px) <> "@" then py = py - 1 : gosub draw2 : endif
if ScanKeyDown(VK_DOWN) and arena$(py+1,px) <> "@" then py = py + 1 : gosub draw2 : endif
if ScanKeyDown(VK_LEFT) and arena$(py,px-1) <> "@" then px = px - 1 : gosub draw2 : endif
if ScanKeyDown(VK_RIGHT) and arena$(py,px+1) <> "@" then px = px + 1 : gosub draw2 : endif
if KeyDown ("0") then
px = 25
py = 10
locate px, py: print "M"
gosub town
endif
wend
'End of Arena Setup
'---------------------------------------------------------------------
'---------------------------------------------------------------------
'Help Subroutine
help:
cls
reset town
printr "Help Info:"
printr
printr "Test Message"
printr
input "Hit the 'Enter Key' to exit help"; help$
drawtext()
goto town
'End of Help Subroutine
'---------------------------------------------------------------------
-Asmodeus