added inventory
This commit is contained in:
parent
3b19e00caa
commit
1e897d0ee0
129
findthrash.bas
129
findthrash.bas
@ -9,18 +9,16 @@ REM GET DICT FILE WITH ITEM NAMES
|
|||||||
' x:28,y14
|
' x:28,y14
|
||||||
linenb=10
|
linenb=10
|
||||||
colnb=18
|
colnb=18
|
||||||
|
statln=linenb+3
|
||||||
win=false
|
win=false
|
||||||
score=0
|
score=0
|
||||||
pl={hp:30,hpx:30,name:"testacles",
|
pl={hp:30,hpx:30,name:"testacles",
|
||||||
dmg:3}
|
dmg:3,nextinv:1}
|
||||||
mob={}
|
mob={}
|
||||||
robx=fix(rnd*colnb)
|
robx=fix(rnd*colnb)
|
||||||
roby=fix(rnd*linenb)
|
roby=fix(rnd*linenb)
|
||||||
kitx=fix(rnd*colnb)
|
|
||||||
kity=fix(rnd*linenb)
|
|
||||||
kitchar = charget
|
|
||||||
' amount mob
|
' amount mob
|
||||||
amob = 7
|
amob = 2
|
||||||
' amount thrash (items)
|
' amount thrash (items)
|
||||||
amount = 5
|
amount = 5
|
||||||
endgame=false
|
endgame=false
|
||||||
@ -28,47 +26,56 @@ thrash = array("{0:{}}")
|
|||||||
map={}
|
map={}
|
||||||
|
|
||||||
rem prg start
|
rem prg start
|
||||||
genThrash(amount)
|
label start
|
||||||
borderscr()
|
|
||||||
dbinit()
|
dbinit()
|
||||||
|
genThrash(amount)
|
||||||
|
|
||||||
|
' mob = genmob(1)
|
||||||
rem grafx loop waiting for win
|
rem grafx loop waiting for win
|
||||||
|
|
||||||
|
borderscr()
|
||||||
repeat
|
repeat
|
||||||
' if win
|
' if dead
|
||||||
if robx = kitx AND roby = kity then
|
if pl.hp =< 0 then
|
||||||
win=true
|
win=false
|
||||||
endgame=true
|
endgame=true
|
||||||
locate linenb,1
|
locate linenb,1
|
||||||
print " You found kitten!"
|
print " You died"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
itemcolscan()
|
||||||
kbctrl()
|
kbctrl()
|
||||||
printobj()
|
printobj()
|
||||||
|
' printmob()
|
||||||
printui()
|
printui()
|
||||||
printrob()
|
|
||||||
itemcolscan()
|
|
||||||
|
|
||||||
until win
|
until endgame
|
||||||
|
|
||||||
|
|
||||||
REM ======FUNCTION SPACE =========-
|
REM ======FUNCTION SPACE =========-
|
||||||
|
|
||||||
|
|
||||||
sub remtrash(x,y)
|
' scan if your on the same tile as item
|
||||||
locate thrash[y].y,thrash[x].x
|
|
||||||
? " "
|
|
||||||
end
|
|
||||||
' scan if ypur om the same tile as item
|
|
||||||
sub itemcolscan()
|
sub itemcolscan()
|
||||||
for i = 1 to amount
|
for iscan = 0 to amount
|
||||||
if robx=thrash[i].x and roby=thrash[i].y then
|
if robx=thrash[iscan].x and roby=thrash[iscan].y then
|
||||||
locate linenb+3,2
|
' if @ is on item note item num
|
||||||
print thrash[i].text
|
locate linenb+3,2
|
||||||
thrash[i].onscreen = false
|
print thrash[iscan].name
|
||||||
fi
|
onitem=iscan
|
||||||
next
|
fi
|
||||||
|
next
|
||||||
|
|
||||||
end
|
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
|
' KEYBOARD CMD and scr bounds scan
|
||||||
sub kbctrl()
|
sub kbctrl()
|
||||||
kb = inkey
|
kb = inkey
|
||||||
@ -97,13 +104,16 @@ sub kbctrl()
|
|||||||
dir="y+"
|
dir="y+"
|
||||||
fi
|
fi
|
||||||
case "q"
|
case "q"
|
||||||
' debug show all continupusly updated content on screen
|
|
||||||
|
cls
|
||||||
locate 3,3
|
locate 3,3
|
||||||
print "testt"
|
print "buyyyyyye"
|
||||||
|
stop
|
||||||
|
case "p"
|
||||||
|
printinfo()
|
||||||
|
case "t"
|
||||||
|
takeitem()
|
||||||
end select
|
end select
|
||||||
' print again to show changes
|
|
||||||
printrob()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
sub printui()
|
sub printui()
|
||||||
@ -111,21 +121,22 @@ sub printui()
|
|||||||
print "HP: "+pl.hp
|
print "HP: "+pl.hp
|
||||||
locate linenb+2,8
|
locate linenb+2,8
|
||||||
? "dmg"+pl.dmg
|
? "dmg"+pl.dmg
|
||||||
|
' status bar 1
|
||||||
locate linenb+3,1
|
locate linenb+3,1
|
||||||
print pl.name
|
print "~~~~~~~~~~~~~~~~~~"
|
||||||
end
|
' status bar 2 is inside the bottom wall... so linenb+1
|
||||||
|
|
||||||
sub monscan(arg)
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
sub printrob()
|
sub printmob()
|
||||||
locate roby,robx
|
for i=1 to amob
|
||||||
print "@"
|
my = mob[i].y
|
||||||
|
mx = mob[i].x
|
||||||
|
locate my,mx
|
||||||
|
print mob[i].ch
|
||||||
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
sub printobj()
|
sub printobj()
|
||||||
rem print thrash
|
rem print thrash
|
||||||
for it=1 to amount
|
for it=1 to amount
|
||||||
@ -140,9 +151,8 @@ sub printobj()
|
|||||||
thrash[it].y = 0
|
thrash[it].y = 0
|
||||||
fi
|
fi
|
||||||
next
|
next
|
||||||
rem and aftr print kitty
|
locate roby,robx
|
||||||
locate kity,kitx
|
print "@"
|
||||||
print "@"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
func charget()
|
func charget()
|
||||||
@ -168,17 +178,19 @@ sub genthrash(amount)
|
|||||||
for index = 1 to amount
|
for index = 1 to amount
|
||||||
local tx = fix(rnd*colnb)
|
local tx = fix(rnd*colnb)
|
||||||
local ty = fix(rnd*linenb)
|
local ty = fix(rnd*linenb)
|
||||||
|
thrash[index].name = "def"
|
||||||
thrash[index].obj = weap.knife
|
thrash[index].obj = weap.knife
|
||||||
itnam=thrash[index].obj.name
|
|
||||||
thrash[index].x = tx
|
thrash[index].x = tx
|
||||||
thrash[index].y = ty
|
thrash[index].y = ty
|
||||||
thrash[index].ch = charge
|
thrash[index].ch = charget
|
||||||
thrash[index].text = itnam
|
thrash[index].text = "testtext"
|
||||||
thrash[index].onscreen = true
|
thrash[index].onscreen = true
|
||||||
|
thrash[index].take = false
|
||||||
next
|
next
|
||||||
|
' proto represents the base item
|
||||||
|
' before stat mod from algory
|
||||||
func genitem()
|
func genitem()
|
||||||
local proto={}
|
proto={}
|
||||||
proto = weap.knife
|
proto = weap.knife
|
||||||
return proto
|
return proto
|
||||||
end
|
end
|
||||||
@ -188,6 +200,7 @@ func dbinit()
|
|||||||
' tload weapdb.dat, byref weap
|
' tload weapdb.dat, byref weap
|
||||||
weap={}
|
weap={}
|
||||||
weap.knife = {name:knife,dmg:3}
|
weap.knife = {name:knife,dmg:3}
|
||||||
|
inv={}
|
||||||
end
|
end
|
||||||
|
|
||||||
sub borderscr()
|
sub borderscr()
|
||||||
@ -203,7 +216,8 @@ next
|
|||||||
end
|
end
|
||||||
|
|
||||||
func genmob(lvl)
|
func genmob(lvl)
|
||||||
for i = 0 to amob
|
for i = 1 to amob
|
||||||
|
pmob={}
|
||||||
pmob[i] = {dmg:2,hpx:30}
|
pmob[i] = {dmg:2,hpx:30}
|
||||||
pmob[i] = {hp:
|
pmob[i] = {hp:
|
||||||
30,name:jello}
|
30,name:jello}
|
||||||
@ -211,6 +225,17 @@ func genmob(lvl)
|
|||||||
pmob[i].y =fix(rnd*linenb)
|
pmob[i].y =fix(rnd*linenb)
|
||||||
pmob[i].alive = true
|
pmob[i].alive = true
|
||||||
pmob[i].onscreen = true
|
pmob[i].onscreen = true
|
||||||
|
pmob[i].ch="!"
|
||||||
next
|
next
|
||||||
|
return pmob
|
||||||
|
end
|
||||||
|
|
||||||
|
sub printinfo()
|
||||||
|
cls
|
||||||
|
repeat
|
||||||
|
locate 3,3
|
||||||
|
print inv
|
||||||
|
until inkey == "v"
|
||||||
|
stop
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user