Compare commits

..

No commits in common. "1e897d0ee0a942808b4e5c7cb9af0ce10ad5458e" and "51f886a8ee4be9749aa9ec30c7fd72475559ef5d" have entirely different histories.

1 changed files with 54 additions and 107 deletions

View File

@ -9,16 +9,18 @@ REM GET DICT FILE WITH ITEM NAMES
' x:28,y14
linenb=10
colnb=18
statln=linenb+3
win=false
score=0
pl={hp:30,hpx:30,name:"testacles",
dmg:3,nextinv:1}
dmg:3}
mob={}
robx=fix(rnd*colnb)
roby=fix(rnd*linenb)
kitx=fix(rnd*colnb)
kity=fix(rnd*linenb)
kitchar = charget
' amount mob
amob = 2
amob = 7
' amount thrash (items)
amount = 5
endgame=false
@ -26,57 +28,45 @@ thrash = array("{0:{}}")
map={}
rem prg start
label start
dbinit()
genThrash(amount)
' mob = genmob(1)
rem grafx loop waiting for win
borderscr()
rem grafx loop waiting for win
repeat
' if dead
if pl.hp =< 0 then
win=false
if robx = kitx AND roby = kity then
win=true
endgame=true
locate linenb,1
print " You died"
print " You found kitten!"
fi
itemcolscan()
kbctrl()
printobj()
' printmob()
printui()
printrob()
collscan()
kbctrl
until endgame
until win
REM ======FUNCTION SPACE =========-
' scan if your on the same tile as item
sub itemcolscan()
for iscan = 0 to amount
if robx=thrash[iscan].x and roby=thrash[iscan].y then
' if @ is on item note item num
locate linenb+3,2
print thrash[iscan].name
onitem=iscan
fi
sub remtrash(x,y)
locate thrash[y].y,thrash[x].x
? " "
end
sub collscan()
for i = 1 to amount
if robx=thrash[i].x and roby=thrash[i].y then
locate linenb+3,2
print thrash[i].text
thrash[i].active = false
fi
next
end
sub takeitem()
locate statln,1
print "you take "
thrash[onitem].onscreen=false
inv[pl.nextinv] =thrash[onitem].obj
pl.nextinv = pl.nextinv + 1
end
' KEYBOARD CMD and scr bounds scan
sub kbctrl()
kb = inkey
' delete old rob
@ -86,16 +76,16 @@ sub kbctrl()
case "h"
if robx > 0 then
robx = robx-1
dir="x-"
fi
' if monstscan(dirP
case "j"
if roby < linenb then
roby = roby+1
dir="x+"
fi
case "k"
if roby > 0 then
roby = roby-1
roby = roby-1
dir="y-"
fi
case "l"
@ -104,16 +94,9 @@ sub kbctrl()
dir="y+"
fi
case "q"
cls
locate 3,3
print "buyyyyyye"
stop
case "p"
printinfo()
case "t"
takeitem()
print "testt"
end select
printrob()
end
sub printui()
@ -121,38 +104,33 @@ sub printui()
print "HP: "+pl.hp
locate linenb+2,8
? "dmg"+pl.dmg
' status bar 1
locate linenb+3,1
print "~~~~~~~~~~~~~~~~~~"
' status bar 2 is inside the bottom wall... so linenb+1
print pl.name
end
sub printmob()
for i=1 to amob
my = mob[i].y
mx = mob[i].x
locate my,mx
print mob[i].ch
next
sub printrob()
locate roby,robx
print "@"
end
sub printobj()
rem print thrash
for it=1 to amount
if thrash[it].onscreen then
if thrash[it].active then
local objx = thrash[it].x
local objy = thrash[it].y
locate objy,objx
print thrash[it].ch
else
' put the item in the unaccesible region of screen
thrash[it].x = 0
thrash[it].y = 0
fi
next
locate roby,robx
print "@"
rem print kitty
locate kity,kitx
print kitchar
end
func charget()
@ -166,48 +144,36 @@ func charget()
case 4
return "?"
case 5
return "+"
return "÷"
case 6
return "$"
end select
end
rem Items are represented by thrash so this func also gens items stats
' assisigning it to the thrash[x].obj object. which will then go as such in the pl inv
rem Items are represented by thrash
sub genthrash(amount)
for index = 1 to amount
local tx = fix(rnd*colnb)
local ty = fix(rnd*linenb)
thrash[index].name = "def"
thrash[index].obj = weap.knife
thrash[index].x = tx
thrash[index].y = ty
thrash[index].ch = charget
thrash[index].text = "testtext"
thrash[index].onscreen = true
thrash[index].take = false
thrash[index].text = "lazy"
thrash[index].active = true
rem thrash[index].item = get
next
' proto represents the base item
' before stat mod from algory
func genitem()
proto={}
proto = weap.knife
return proto
end
end
func dbinit()
' tload weapdb.dat, byref weap
weap={}
weap.knife = {name:knife,dmg:3}
inv={}
func textget()
r = rnd()*len(dict)
return 'placeholder'
end
sub borderscr()
cls
for i = 0 to linenb+1
locate i+1,colnb+1
? "#"
? "X"
for i2 = 0 to colnb+1
locate linenb+1,i2
print "X"
@ -216,26 +182,7 @@ next
end
func genmob(lvl)
for i = 1 to amob
pmob={}
pmob[i] = {dmg:2,hpx:30}
pmob[i] = {hp:
30,name:jello}
pmob[i].x = fix(rnd*colnb)
pmob[i].y =fix(rnd*linenb)
pmob[i].alive = true
pmob[i].onscreen = true
pmob[i].ch="!"
for i = 0 to amob
pmob[i] = {hp:30,name:jello}
next
return pmob
end
sub printinfo()
cls
repeat
locate 3,3
print inv
until inkey == "v"
stop
end
end