changed file

This commit is contained in:
ascii benefactor 2021-06-16 05:04:12 -04:00
parent e80ae27e00
commit 51f886a8ee
1 changed files with 40 additions and 18 deletions

View File

@ -1,23 +1,29 @@
REM SmallBASIC REM SmallBASIC
REM ROBOT FINDS KITTEN REM Small RL game forked of my Robotfindskitten game
REM BY ASCIIBENEFACTOR REM BY ASCIIBENEFACTOR
rem rem unfinished !
REM GET DICT FILE WITH ITEM NAMES REM GET DICT FILE WITH ITEM NAMES
' x:28,y14 ' x:28,y14
linenb=10 linenb=10
colnb=20 colnb=18
win=false win=false
score=0 score=0
pl={hp:30,hpx:30,name:"testacles",
dmg:3}
mob={}
robx=fix(rnd*colnb) robx=fix(rnd*colnb)
roby=fix(rnd*linenb) roby=fix(rnd*linenb)
kitx=fix(rnd*colnb) kitx=fix(rnd*colnb)
kity=fix(rnd*linenb) kity=fix(rnd*linenb)
kitchar = charget kitchar = charget
' amount mob
amob = 7
' amount thrash (items)
amount = 5 amount = 5
endgame=false
thrash = array("{0:{}}") thrash = array("{0:{}}")
map={} map={}
@ -28,6 +34,7 @@ rem grafx loop waiting for win
repeat repeat
if robx = kitx AND roby = kity then if robx = kitx AND roby = kity then
win=true win=true
endgame=true
locate linenb,1 locate linenb,1
print " You found kitten!" print " You found kitten!"
fi fi
@ -36,11 +43,8 @@ repeat
printrob() printrob()
collscan() collscan()
if inkey = nil then
delay 10
else
kbctrl kbctrl
endif
until win until win
@ -48,8 +52,8 @@ until win
REM ======FUNCTION SPACE =========- REM ======FUNCTION SPACE =========-
sub remtrash(nb,x,y) sub remtrash(x,y)
locate thrash[y].x,thrash[x].x locate thrash[y].y,thrash[x].x
? " " ? " "
end end
@ -90,16 +94,18 @@ sub kbctrl()
dir="y+" dir="y+"
fi fi
case "q" case "q"
break print "testt"
end select end select
printrob() printrob()
end end
sub printui() sub printui()
locate linenb+1,1 locate linenb+2,1
print "Robot finds kitten" print "HP: "+pl.hp
locate linenb+2,6 locate linenb+2,8
print "score:"+score ? "dmg"+pl.dmg
locate linenb+3,1
print pl.name
end end
sub printrob() sub printrob()
@ -116,15 +122,19 @@ sub printobj()
local objy = thrash[it].y local objy = thrash[it].y
locate objy,objx locate objy,objx
print thrash[it].ch print thrash[it].ch
fi else
thrash[it].x = 0
thrash[it].y = 0
fi
next next
rem print kitty
locate kity,kitx locate kity,kitx
print kitchar print kitchar
end end
func charget() func charget()
select case fix(rnd*4) select case fix(rnd*6)
case 1 case 1
return "&" return "&"
case 2 case 2
@ -133,9 +143,14 @@ func charget()
return "#" return "#"
case 4 case 4
return "?" return "?"
case 5
return "÷"
case 6
return "$"
end select end select
end end
rem Items are represented by thrash
sub genthrash(amount) sub genthrash(amount)
for index = 1 to amount for index = 1 to amount
local tx = fix(rnd*colnb) local tx = fix(rnd*colnb)
@ -145,6 +160,7 @@ sub genthrash(amount)
thrash[index].ch = charget thrash[index].ch = charget
thrash[index].text = "lazy" thrash[index].text = "lazy"
thrash[index].active = true thrash[index].active = true
rem thrash[index].item = get
next next
end end
@ -156,7 +172,7 @@ end
sub borderscr() sub borderscr()
cls cls
for i = 0 to linenb+1 for i = 0 to linenb+1
locate i,colnb+1 locate i+1,colnb+1
? "X" ? "X"
for i2 = 0 to colnb+1 for i2 = 0 to colnb+1
locate linenb+1,i2 locate linenb+1,i2
@ -164,3 +180,9 @@ for i = 0 to linenb+1
next next
next next
end end
func genmob(lvl)
for i = 0 to amob
pmob[i] = {hp:30,name:jello}
next
end