This commit is contained in:
ascii benefactor 2021-06-15 04:58:16 -04:00
parent 829f923ccb
commit e80ae27e00
1 changed files with 18 additions and 11 deletions

View File

@ -11,6 +11,7 @@ linenb=10
colnb=20
win=false
score=0
robx=fix(rnd*colnb)
roby=fix(rnd*linenb)
kitx=fix(rnd*colnb)
@ -18,20 +19,21 @@ kity=fix(rnd*linenb)
kitchar = charget
amount = 5
thrash = array("{0:{}}")
map={}
rem prg start
genThrash(amount)
borderscr()
rem grafx loop waiting for win
repeat
if robx = kitx AND roby = kity then
win=true
locate linenb,1
print " You found kitten!"
fi
printrob()
printobj()
printkit()
printui()
printrob()
collscan()
if inkey = nil then
@ -52,10 +54,11 @@ sub remtrash(nb,x,y)
end
sub collscan()
for local i = 1 to amount
for i = 1 to amount
if robx=thrash[i].x and roby=thrash[i].y then
locate linenb+1,1
locate linenb+3,2
print thrash[i].text
thrash[i].active = false
fi
next
end
@ -86,6 +89,8 @@ sub kbctrl()
robx = robx+1
dir="y+"
fi
case "q"
break
end select
printrob()
end
@ -102,19 +107,20 @@ sub printrob()
print "@"
end
sub printkit()
locate kity,kitx
print kitchar
end
sub printobj()
rem print thrash
for it=1 to amount
if thrash[it].active then
local objx = thrash[it].x
local objy = thrash[it].y
locate objy,objx
print thrash[it].ch
fi
next
locate kity,kitx
print kitchar
end
func charget()
@ -137,7 +143,8 @@ sub genthrash(amount)
thrash[index].x = tx
thrash[index].y = ty
thrash[index].ch = charget
thrash[index].text = textget
thrash[index].text = "lazy"
thrash[index].active = true
next
end