Been a long time since i entered one of these, but here we go:
set display mode 800,600,32
sync on
sync rate 0
autocam off
hide mouse
steplength#=0.5
cursorsteplength#=0.2
type tower
x as integer
y as integer
ttype as integer
built as integer
initbuilt as integer
target as integer
delay as integer
delaysteps as integer
endtype
type bullet
startx as integer
starty as integer
endx as integer
endy as integer
damage as integer
btype$ as string
endtype
type enemy
x as integer
y as integer
health as integer
movedx as integer
movedy as integer
etype$ as string
endtype
type pathpos
xoff as integer
yoff as integer
endtype
set text size 8
start:
dim towers(0) as tower
dim bullets(0) as bullet
dim enemies(0) as enemy
dim path(0) as pathpos
dim pathcalc(20,15) as integer
enemycount=0
enemyhealth=0
enemytype$=""
timestep#=0
cursortime#=0
steps=0
cursorstep=0
lasttower=0
tracksteps=0
showpath=1
repeat
ink rgb(0,255,0),0
set cursor (-1)*8+100,(-1)*12+20
print "+------------------------------------------------------------+"
set cursor (-1)*8+100,(45)*12+20
print "+------------------------------------------------------------+"
for c=0 to 20
set cursor (-1)*8+100,(c)*12+20
print ":"
next c
for c=24 to 44
set cursor (-1)*8+100,(c)*12+20
print ":"
next c
for c=0 to 20
set cursor (60)*8+100,(c)*12+20
print ":"
next c
for c=24 to 44
set cursor (60)*8+100,(c)*12+20
print ":"
next c
set cursor (2)*8+100,(12)*12+20
print "YOUR MISSION: STOP THE EVIL, EARTH MAULING LETTERS"
set cursor (2)*8+100,(13)*12+20
print " FROM GETTING FROM THE LEFT GATE TO"
set cursor (2)*8+100,(14)*12+20
print " THE RIGHT GATE."
set cursor (2)*8+100,(16)*12+20
print "NOTE: IF EXTRA MOTIVATION IS REQUIRED, ALTERNATE,"
set cursor (2)*8+100,(17)*12+20
print "MORE DRAMATIC DESCRIPTIONS MAY BE SUBSTITUTED WITH"
set cursor (2)*8+100,(18)*12+20
print "THE WORD 'GATE'."
set cursor (2)*8+100,(21)*12+20
print ":!: PLACE TOWERS BY CLICKING THE LEFT MOUSE BUTTON."
set cursor (2)*8+100,(23)*12+20
print ":!: SELECT DIFFERENT TOWERS BY PRESSING KEYS '1','2',"
set cursor (2)*8+100,(24)*12+20
print " OR '3'"
set cursor (2)*8+100,(26)*12+20
print ":!: REMOVE A TOWER BY CLICKING THE RIGHT MOUSE BUTTON"
set cursor (2)*8+100,(29)*12+20
print "BETWEEN WAVES OF EVIL, EARTH MAULING LETTERS, THE PATH"
set cursor (2)*8+100,(30)*12+20
print "THEY WILL TAKE IS SHOWN IN DARK RED. ONCE A WAVE STARTS,"
set cursor (2)*8+100,(31)*12+20
print "LETTERS WILL BEGIN MOVING FROM THE LEFT GATE. YOUR TOWERS"
set cursor (2)*8+100,(32)*12+20
print "WILL AUTOMATICALLY SELECT THEIR TARGETS AND FIRE AT THEIR"
set cursor (2)*8+100,(33)*12+20
print "OWN DISCRETION. MAXIMISE THEIR CHANCE OF SUCCESS BY"
set cursor (2)*8+100,(34)*12+20
print "DELAYING THE LETTERS PROGRESS WITH YOUR TOWER PLACEMENT."
set cursor (2)*8+100,(35)*12+20
print "MAKING EFFICIENT 'MAZES' IS POINT OF THE GAME. POINTS FOR"
set cursor (2)*8+100,(36)*12+20
print "BUILDING MORE TOWERS ARE AWARDED FOR EACH LETTER KILL."
set cursor (2)*8+100,(39)*12+20
print "GOOD LUCK! (OH YEAH, PRESS ENTER TO BEGIN)"
set cursor (2)*8+100,(41)*12+20
print "PS. WATCH OUT FOR THE VOWELS, THEY'RE PARTICULARLY NASTY."
set cursor (2)*8+100,(42)*12+20
print " YOU'LL NEED TO BUILD AN ANTI VOWEL TOWER TO NAIL 'EM."
set cursor (2)*8+100,(43)*12+20
print " THEY START APPEARING AT WAVE 9, SO BE READY."
ink rgb(0,0,255),0
set cursor (2)*8+100,(21)*12+20
print " LEFT MOUSE BUTTON."
set cursor (2)*8+100,(23)*12+20
print " 1 2"
set cursor (2)*8+100,(24)*12+20
print " 3"
set cursor (2)*8+100,(26)*12+20
print " RIGHT MOUSE BUTTON"
set cursor (15)*8+100,(2)*12+20
print " _ _______ ___ "
set cursor (15)*8+100,(3)*12+20
print " / \ |__ __| | \ "
set cursor (15)*8+100,(4)*12+20
print " / ^ \ | | | |\ \ "
set cursor (15)*8+100,(5)*12+20
print " / /_\ \ | | | || |"
set cursor (15)*8+100,(6)*12+20
print " / _____ \ | | | |/ / "
set cursor (15)*8+100,(7)*12+20
print " /_/ \_\ |_| |___/ "
set cursor (15)*8+100,(9)*12+20
print "-----ASCII-TOWER-DEFENSE-----"
ink rgb(255,0,0),0
set cursor (2)*8+100,(12)*12+20
print " EVIL, EARTH MAULING LETTERS"
set cursor (2)*8+100,(29)*12+20
print " EVIL, EARTH MAULING LETTERS"
ink rgb(100,0,0),0
set cursor (2)*8+100,(30)*12+20
print " DARK RED"
sync
until returnkey()
oldtime=timer()
checkpoint=0
tickerbuffer$=""
ticker$=" "
tickertime#=0
tickerstep#=0.1
timeleft#=12
level=1
towerschanged=1
enemysteps=0
enemydelay=0
money=50
bounty=0
lives=10
cursortype=1
do
newtime=timer()
time#=(newtime-oldtime)/1000.0
oldtime=newtime
timestep#=timestep#+time#
steps=0
while timestep#>steplength#
steps=steps+1
timestep#=timestep#-steplength#
endwhile
key=scancode()
if (key>1) and (key<5)
cursortype=key-1
endif
if (timeleft#>0) And (enemycount=0) And (array count(enemies(0))=0)
timeleft#=timeleft#-time#
if (int(timeleft#+time#)<>int(timeleft#))
if (int(timeleft#)+1)<11 then tickerbuffer$=str$(int(timeleft#)+1)
endif
showpath=1
else
if (enemycount=0) And (array count(enemies(0))=0)
for c=0 to array count(towers(0))-1
towers(c).target=-1
next c
select level
case 1
enemycount=10
enemytype$="k"
endcase
case 2
enemycount=10
enemytype$="m"
endcase
case 3
enemycount=10
enemytype$="K"
endcase
case 4
enemycount=15
enemytype$="m"
endcase
case 5
enemycount=10
enemytype$="M"
endcase
case 6
enemycount=10
enemytype$="b"
endcase
case 7
enemycount=25
enemytype$="M"
endcase
case 8
enemycount=20
enemytype$="b"
endcase
case 9
enemycount=25
enemytype$="i"
endcase
case 10
enemycount=1
enemytype$="g"
endcase
case 11
enemycount=15
enemytype$="n"
endcase
case 12
enemycount=10
enemytype$="B"
endcase
case 13
enemycount=20
enemytype$="n"
endcase
case 14
enemycount=15
enemytype$="N"
endcase
case 15
enemycount=20
enemytype$="I"
endcase
case 16
enemycount=0
enemytype$=""
lives=0
endcase
endselect
tickerbuffer$=".:: Wave "+str$(level)+" ::."
timeleft#=12
showpath=0
select enemytype$
case "k"
enemyhealth=10
bounty=2
enemydelay=2
endcase
case "K"
enemyhealth=14
bounty=2
enemydelay=2
endcase
case "m"
enemyhealth=8
bounty=1
enemydelay=1
endcase
case "M"
enemyhealth=14
bounty=2
enemydelay=1
endcase
case "b"
enemyhealth=46
bounty=2
enemydelay=3
endcase
case "B"
enemyhealth=150
bounty=4
enemydelay=3
endcase
case "i"
enemyhealth=56
bounty=3
enemydelay=2
endcase
case "I"
enemyhealth=200
bounty=4
enemydelay=2
endcase
case "g"
enemyhealth=300
bounty=70
enemydelay=1
endcase
case "n"
enemyhealth=70
bounty=3
enemydelay=1
endcase
case "N"
enemyhealth=100
bounty=3
enemydelay=1
endcase
endselect
level=level+1
endif
endif
//if lmb=0 then cls
cls
lmb=0
mmb=0
rmb=0
mv=mouseclick()
if int(mv/8)=1
mv=mv-8
endif
if int(mv/4)=1
mv=mv-4
mmb=1
endif
if int(mv/2)=1
mv=mv-2
rmb=1
endif
if mv=1
lmb=1
endif
cursorx=int((mousex()/8)/3)
cursory=int((mousey()/12)/3)
if cursorx>19 then cursorx=19
if cursory>14 then cursory=14
if lmb=1
cursorsteplength#=0.05
else
cursorsteplength#=cursorsteplength#+((0.2-cursorsteplength#)*0.7*time#)
endif
cursortime#=cursortime#+time#
while cursortime#>cursorsteplength#
cursorstep=cursorstep+1
cursortime#=cursortime#-cursorsteplength#
endwhile
while cursorstep>3
cursorstep=cursorstep-4
endwhile
lasttower=-1
if lmb=1
occupied=0
for c=0 to array count(towers(0))-1
if (towers(c).x=cursorx) AND (towers(c).y=cursory) then occupied=1
next c
for c=0 to array count(enemies(0))-1
if (enemies(c).x=cursorx) AND (enemies(c).y=cursory) then occupied=1
next c
if occupied=0
select cursortype
case 1
cost=10
endcase
case 2
cost=40
endcase
case 3
cost=80
endcase
endselect
if money>=cost
money=money-cost
towerschanged=1
lasttower=addtower(cursorx,cursory,cursortype)
endif
endif
endif
if rmb=1
for c=0 to array count(towers(0))-1
if (towers(c).x=cursorx) AND (towers(c).y=cursory)
deletetower(c)
money=money+7
towerschanged=1
tickerbuffer$=" Deleted!"
endif
next c
endif
while towerschanged=1
towerschanged=0
for cx=0 to 19
for cy=0 to 14
pathcalc(cx,cy)=-1
next cy
next cx
for c=0 to array count(towers(0))-1
pathcalc(towers(c).x,towers(c).y)=-2
next c
foundnew=1
pathnum=0
while foundnew=1
pathcalc(19,7)=0
foundnew=0
for cx=0 to 20
for cy=0 to 15
if pathcalc(cx,cy)=-1
if cx>0
if pathcalc(cx-1,cy)=pathnum
pathcalc(cx,cy)=pathnum+1
foundnew=1
endif
endif
if cx<19
if pathcalc(cx+1,cy)=pathnum
pathcalc(cx,cy)=pathnum+1
foundnew=1
endif
endif
if cy>0
if pathcalc(cx,cy-1)=pathnum
pathcalc(cx,cy)=pathnum+1
foundnew=1
endif
endif
if cy<14
if pathcalc(cx,cy+1)=pathnum
pathcalc(cx,cy)=pathnum+1
foundnew=1
endif
endif
endif
next cy
next cx
pathnum=pathnum+1
endwhile
if (pathcalc(0,7)<0)
deletetower(lasttower)
select towers(lasttower).ttype
case 1
money=money+10
endcase
case 2
money=money+40
endcase
case 3
money=money+50
endcase
endselect
towerschanged=1
else
if lasttower>-1
if ((towers(lasttower).x=19) AND (towers(lasttower).y=7))
deletetower(lasttower)
select towers(lasttower).ttype
case 1
money=money+10
endcase
case 2
money=money+40
endcase
case 3
money=money+50
endcase
endselect
endif
endif
dim path(0) as pathpos
posx=0
posy=7
pathnum=pathcalc(0,7)
loops=0
num=0
while (posx<>19) OR (posy<>7)
dim path(num+1) as pathpos
loops=loops+1
changex=0
changey=0
if posx>0
if pathcalc(posx-1,posy)=pathnum-1
path(num).xoff=-1
path(num).yoff=0
//changex=-1
posx=posx-1
endif
endif
if posx<19
if pathcalc(posx+1,posy)=pathnum-1
path(num).xoff=1
path(num).yoff=0
//changex=1
posx=posx+1
endif
endif
if posy>0
if pathcalc(posx,posy-1)=pathnum-1
path(num).xoff=0
path(num).yoff=-1
//changey=-1
posy=posy-1
endif
endif
if posy<14
if pathcalc(posx,posy+1)=pathnum-1
path(num).xoff=0
path(num).yoff=1
//changey=1
posy=posy+1
endif
endif
posx=posx+changex
posy=posy+changey
pathnum=pathnum-1
num=num+1
endwhile
endif
endwhile
ink rgb(255,128,0),0
for c=0 to array count(bullets(0))-1
if bullets(c).btype$="("
if (timestep#/steplength#)>0.5
set cursor ((bullets(c).startx*3.0)-1)*8+100,((bullets(c).starty*3.0)-1)*12+20
print "/ ¯ \"
set cursor ((bullets(c).startx*3.0)-2)*8+100,((bullets(c).starty*3.0)+1)*12+20
print "| |"
set cursor ((bullets(c).startx*3.0)-1)*8+100,((bullets(c).starty*3.0)+3)*12+20
print "\ _ /"
endif
else
px#=bullets(c).startx+((bullets(c).endx-bullets(c).startx)*(timestep#/steplength#))
py#=bullets(c).starty+((bullets(c).endy-bullets(c).starty)*(timestep#/steplength#))
set cursor (int((px#)*3.0)+1)*8+100,(int((py#)*3.0)+1)*12+20
print bullets(c).btype$
endif
next c
if steps>0
for c=0 to array count(bullets(0))-1
hit=-1
if bullets(c).btype$="("
for b=0 to array count(enemies(0))-1
if (abs(enemies(b).x-bullets(c).startx)+abs(enemies(b).y-bullets(c).starty))<3
enemies(b).health=enemies(b).health-10
endif
next b
else
for b=0 to array count(enemies(0))-1
if (enemies(b).x=bullets(c).endx) AND (enemies(b).y=bullets(c).endy)
hit=b
endif
next b
select bullets(c).btype$
case "·"
enemies(hit).health=enemies(hit).health-2
endcase
case "*"
if (enemies(hit).etype$="i") OR (enemies(hit).etype$="I")
enemies(hit).health=enemies(hit).health-15
endif
endcase
endselect
endif
next c
dim bullets(0) as bullet
c=0
while c<array count(enemies(0))
if enemies(c).health<1
deleteenemy(c)
money=money+bounty
c=c-1
endif
c=c+1
endwhile
endif
if (enemycount>0) or (array count(enemies(0))<>0)
for n=1 to steps
c=0
while c<array count(enemies(0))
if (enemies(c).x=19) AND (enemies(c).y=7)
deleteenemy(c)
lives=lives-1
c=c-1
endif
c=c+1
endwhile
for c=0 to array count(enemies(0))-1
moved=0
enemies(c).movedx=0
enemies(c).movedy=0
if enemies(c).x>0
if (pathcalc(enemies(c).x-1,enemies(c).y)=pathcalc(enemies(c).x,enemies(c).y)-1) AND moved=0
enemies(c).x=enemies(c).x-1
enemies(c).movedx=1
moved=1
endif
endif
if enemies(c).x<19
if (pathcalc(enemies(c).x+1,enemies(c).y)=pathcalc(enemies(c).x,enemies(c).y)-1) AND moved=0
enemies(c).x=enemies(c).x+1
enemies(c).movedx=-1
moved=1
endif
endif
if enemies(c).y>0
if (pathcalc(enemies(c).x,enemies(c).y-1)=pathcalc(enemies(c).x,enemies(c).y)-1) AND moved=0
enemies(c).y=enemies(c).y-1
enemies(c).movedy=1
moved=1
endif
endif
if enemies(c).y<14
if (pathcalc(enemies(c).x,enemies(c).y+1)=pathcalc(enemies(c).x,enemies(c).y)-1) AND moved=0
enemies(c).y=enemies(c).y+1
enemies(c).movedy=-1
moved=1
endif
endif
next c
enemysteps=enemysteps+1
if enemysteps>=enemydelay
enemysteps=enemysteps-enemydelay
if enemycount>0
addenemy(0,7,enemyhealth,enemytype$)
enemycount=enemycount-1
endif
endif
next n
endif
if lives<1
repeat
ink rgb(0,255,0),0
set cursor (-1)*8+100,(-1)*12+20
print "+------------------------------------------------------------+"
set cursor (-1)*8+100,(45)*12+20
print "+------------------------------------------------------------+"
for c=0 to 20
set cursor (-1)*8+100,(c)*12+20
print ":"
next c
for c=24 to 44
set cursor (-1)*8+100,(c)*12+20
print ":"
next c
for c=0 to 20
set cursor (60)*8+100,(c)*12+20
print ":"
next c
for c=24 to 44
set cursor (60)*8+100,(c)*12+20
print ":"
next c
if level>15
ink rgb(0,255,0),0
set cursor (4)*8+100,(12)*12+20
print "CONGRATULATIONS! YOU HAVE SUCCESFULLY DIVERTED"
set cursor (4)*8+100,(13)*12+20
print "THE WRATH OF THE PIXELATED CHARACTER MENACE! "
set cursor (4)*8+100,(16)*12+20
print "(FOR NOW, ANYWAY)"
set cursor (22)*8+100,(24)*12+20
print "PRESS ENTER TO CONTINUE"
else
ink rgb(0,255,0),0
set cursor (4)*8+100,(12)*12+20
print "YOU HAVE SUCCUMBED TO THE SHEER ALPHABETICAL"
set cursor (4)*8+100,(13)*12+20
print "PRESSURE OF WAVE "+str$(level-1)+"!"
set cursor (22)*8+100,(20)*12+20
print "PRESS ENTER TO CONTINUE"
endif
sync
until returnkey()=1
repeat
until returnkey()<>1
cls
goto start
endif
ink rgb(255,255,255),0
//for cx=0 to 19
// for cy=0 to 14
// set cursor ((cx*3)+1)*8+100,((cy*3)+1)*12+20
// print pathcalc(cx,cy)
// next cy
//next cx
ink rgb(255,0,0),0
enemystep=int((timestep#/steplength#)*3.0)
for c=0 to array count(enemies(0))-1
select enemystep
case 0
set cursor (((enemies(c).x+enemies(c).movedx)*3)+1-enemies(c).movedx)*8+100,(((enemies(c).y+enemies(c).movedy)*3)+1-enemies(c).movedy)*12+20
endcase
case 1
set cursor (((enemies(c).x)*3)+1+enemies(c).movedx)*8+100,(((enemies(c).y)*3)+1+enemies(c).movedy)*12+20
endcase
case 2
set cursor ((enemies(c).x*3)+1)*8+100,((enemies(c).y*3)+1)*12+20
endcase
endselect
print enemytype$
next c
if showpath=1
tracksteps=tracksteps+steps
while tracksteps>2
tracksteps=tracksteps-3
endwhile
posx=0
posy=7
ink rgb(100,0,0),0
for c=0 to array count(path(0))-1
if tracksteps=0
set cursor ((posx*3)+1)*8+100,((posy*3)+1)*12+20
print "O"
set cursor (((posx+path(c).xoff)*3)+1-path(c).xoff)*8+100,(((posy+path(c).yoff)*3)+1-path(c).yoff)*12+20
print "·"
endif
if tracksteps=1
set cursor ((posx*3)+1+path(c).xoff)*8+100,((posy*3)+1+path(c).yoff)*12+20
print "O"
set cursor ((posx*3)+1)*8+100,((posy*3)+1)*12+20
print "·"
endif
if tracksteps=2
set cursor (((posx+path(c).xoff)*3)+1-path(c).xoff)*8+100,(((posy+path(c).yoff)*3)+1-path(c).yoff)*12+20
print "O"
set cursor ((posx*3)+1+path(c).xoff)*8+100,((posy*3)+1+path(c).yoff)*12+20
print "·"
endif
//if tracksteps=1 then set cursor ((posx*3)+1+path(c).xoff)*8+100,((posy*3)+1+path(c).yoff)*12+20
//if tracksteps=2 then set cursor (((posx+path(c).xoff)*3)+1-path(c).xoff)*8+100,(((posy+path(c).yoff)*3)+1-path(c).yoff)*12+20
//print "o"
//print "o"
posx=posx+path(c).xoff
posy=posy+path(c).yoff
next c
endif
ink rgb(0,255,0),0
set cursor 0,0
print screen fps()," fps"
for c=0 to array count(towers(0))-1
if towers(c).built>0
mult=towers(c).built*towers(c).built
if mult<int(towers(c).initbuilt*1.2) then mult=int(towers(c).initbuilt*1.2)
else
mult=0
endif
ink rgb(int((255.0*towers(c).built)/towers(c).initbuilt),int((255.0*towers(c).built)/towers(c).initbuilt),255),rgb(0,0,0)
select towers(c).ttype
case 1
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3))*12+20
if rnd(mult)<towers(c).initbuilt then print "\ /" else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3+1))*12+20
if rnd(mult)<towers(c).initbuilt then print " # " else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3)+2)*12+20
if rnd(mult)<towers(c).initbuilt then print "/ \" else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
endcase
case 2
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3))*12+20
if rnd(mult)<towers(c).initbuilt then print "\ /" else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3+1))*12+20
if rnd(mult)<towers(c).initbuilt then print "<=>" else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3)+2)*12+20
if rnd(mult)<towers(c).initbuilt then print "/ \" else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
endcase
case 3
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3))*12+20
if rnd(mult)<towers(c).initbuilt then print "/-\" else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3+1))*12+20
if rnd(mult)<towers(c).initbuilt then print ")O(" else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
set cursor ((towers(c).x*3))*8+100,((towers(c).y*3)+2)*12+20
if rnd(mult)<towers(c).initbuilt then print "\-/" else print chr$(rnd(255))+chr$(rnd(255))+chr$(rnd(255))
endcase
endselect
if towers(c).built>0 then towers(c).built=towers(c).built-steps
towers(c).delaysteps=towers(c).delaysteps+steps
if (towers(c).built=0) AND (towers(c).delaysteps>=towers(c).delay)
towers(c).delaysteps=towers(c).delaysteps-towers(c).delay
if array count(enemies(0))>0
newneeded=0
if towers(c).target<>-1
if array count(enemies(0))>(towers(c).target)
select towers(c).ttype
case 1
if (abs(enemies(towers(c).target).x-towers(c).x)+abs(enemies(towers(c).target).y-towers(c).y))<5
else
newneeded=1
endif
endcase
case 2
if (enemies(towers(c).target).etype$="i") OR (enemies(towers(c).target).etype$="I")
if (abs(enemies(towers(c).target).x-towers(c).x)+abs(enemies(towers(c).target).y-towers(c).y))<6
else
newneeded=1
endif
endif
endcase
case 3
if (abs(enemies(towers(c).target).x-towers(c).x)+abs(enemies(towers(c).target).y-towers(c).y))<3
else
newneeded=1
endif
endcase
endselect
else
newneeded=1
endif
else
newneeded=1
endif
if newneeded=1
towers(c).target=-1
for b=0 to array count(enemies(0))-1
select towers(c).ttype
case 1
if (abs(enemies(b).x-towers(c).x)+abs(enemies(b).y-towers(c).y))<5
towers(c).target=b
endif
endcase
case 2
if (enemies(b).etype$="i") OR (enemies(b).etype$="I")
if (abs(enemies(b).x-towers(c).x)+abs(enemies(b).y-towers(c).y))<6
towers(c).target=b
endif
endif
endcase
case 3
if (abs(enemies(b).x-towers(c).x)+abs(enemies(b).y-towers(c).y))<3
towers(c).target=b
endif
endcase
endselect
next b
endif
if towers(c).target<>-1
addbullet(towers(c).x,towers(c).y,enemies(towers(c).target).x,enemies(towers(c).target).y,towers(c).ttype)
else
towers(c).delaysteps=towers(c).delaysteps+steps
if towers(c).delaysteps>towers(c).delay then towers(c).delaysteps=towers(c).delay
endif
endif
endif
next c
ink rgb(0,255,0),0
select cursorstep
case 0
set cursor ((cursorx*3))*8+100,((cursory*3))*12+20
print "-\ "
set cursor ((cursorx*3))*8+100,((cursory*3)+1)*12+20
print " x "
set cursor ((cursorx*3))*8+100,((cursory*3)+2)*12+20
print " \-"
endcase
case 1
set cursor ((cursorx*3))*8+100,((cursory*3))*12+20
print " \|"
set cursor ((cursorx*3))*8+100,((cursory*3)+1)*12+20
print " x "
set cursor ((cursorx*3))*8+100,((cursory*3)+2)*12+20
print "|\ "
endcase
case 2
set cursor ((cursorx*3))*8+100,((cursory*3))*12+20
print " |"
set cursor ((cursorx*3))*8+100,((cursory*3)+1)*12+20
print "/x/"
set cursor ((cursorx*3))*8+100,((cursory*3)+2)*12+20
print "| "
endcase
case 3
set cursor ((cursorx*3))*8+100,((cursory*3))*12+20
print "- "
set cursor ((cursorx*3))*8+100,((cursory*3)+1)*12+20
print "/x/"
set cursor ((cursorx*3))*8+100,((cursory*3)+2)*12+20
print " -"
endcase
endselect
set cursor (-1)*8+100,(-1)*12+20
print "+------------------------------------------------------------+"
set cursor (-1)*8+100,(45)*12+20
print "+------------------------------------------------------------+"
for c=0 to 20
set cursor (-1)*8+100,(c)*12+20
print ":"
next c
for c=24 to 44
set cursor (-1)*8+100,(c)*12+20
print ":"
next c
for c=0 to 20
set cursor (60)*8+100,(c)*12+20
print ":"
next c
for c=24 to 44
set cursor (60)*8+100,(c)*12+20
print ":"
next c
set cursor 200,200
ink rgb(255,255,255),0
tickertime#=tickertime#+time#
while tickertime#>tickerstep#
tickertime#=tickertime#-tickerstep#
while len(ticker$)<60
ticker$=ticker$+" "
endwhile
ticker$=right$(ticker$,59)+left$(tickerbuffer$,1)
tickerbuffer$=right$(tickerbuffer$,len(tickerbuffer$)-1)
endwhile
set cursor 100,0
print ticker$
set cursor ((21*3))*8+100,((0))*12+20
print "Tower points: "+str$(money)
set cursor ((21*3))*8+100,((2))*12+20
print " Lives: "+str$(lives)
if cursortype=1 then ink rgb(0,0,255),0 else ink rgb(255,255,255),0
set cursor ((21*3))*8+100,((3*3))*12+20
print "\ /"
set cursor ((21*3))*8+100,((3*3+1))*12+20
print " # "
set cursor ((21*3))*8+100,((3*3)+2)*12+20
print "/ \"
set cursor (63)*8+100,(7)*12+20
print "1: Pulse tower"
set cursor (67)*8+100,(9)*12+20
print "Cost: 10"
set cursor (67)*8+100,(10)*12+20
print "Attack: 2"
set cursor (67)*8+100,(11)*12+20
print "Range: 4"
if cursortype=2 then ink rgb(0,0,255),0 else ink rgb(255,255,255),0
set cursor ((21*3))*8+100,((5*3)+2)*12+20
print "\ /"
set cursor ((21*3))*8+100,((5*3)+3)*12+20
print "<=>"
set cursor ((21*3))*8+100,((5*3)+4)*12+20
print "/ \"
set cursor (63)*8+100,(15)*12+20
print "2: Anti Vowel Tower"
set cursor (67)*8+100,(17)*12+20
print "Cost: 40"
set cursor (67)*8+100,(18)*12+20
print "Attack: 15"
set cursor (67)*8+100,(19)*12+20
print "Range: 6"
set cursor (67)*8+100,(20)*12+20
print "Only attacks vowels"
if cursortype=3 then ink rgb(0,0,255),0 else ink rgb(255,255,255),0
set cursor ((21*3))*8+100,((8*3)+1)*12+20
print "/-\"
set cursor ((21*3))*8+100,((8*3)+2)*12+20
print ")O("
set cursor ((21*3))*8+100,((8*3)+3)*12+20
print "\-/"
set cursor (63)*8+100,(23)*12+20
print "3: Thump Tower"
set cursor (67)*8+100,(25)*12+20
print "Cost: 80"
set cursor (67)*8+100,(26)*12+20
print "Attack: 10"
set cursor (67)*8+100,(27)*12+20
print "Range: 2"
set cursor (67)*8+100,(28)*12+20
print "Area effect"
//print cursorsteplength#
sync
loop
function deletetower(towernum)
for c=towernum to array count(towers(0))-2
towers(c).x=towers(c+1).x
towers(c).y=towers(c+1).y
towers(c).ttype=towers(c+1).ttype
towers(c).built=towers(c+1).built
towers(c).initbuilt=towers(c+1).initbuilt
towers(c).target=towers(c+1).target
towers(c).delay=towers(c+1).delay
towers(c).delaysteps=towers(c+1).delaysteps
next c
dim towers(array count(towers(0))-1) as tower
endfunction
function addtower(x,y,ttype)
num= array count(towers(0))
dim towers(num+1) as tower
towers(num).x=x
towers(num).y=y
towers(num).ttype=ttype
towers(num).built=16
towers(num).initbuilt=16
towers(num).target=-1
towers(num).delay=2
towers(num).delaysteps=0
endfunction num
function addenemy(x,y,health,etype$)
num= array count(enemies(0))
dim enemies(num+1) as tower
enemies(num).x=x
enemies(num).y=y
enemies(num).movedx=-1
enemies(num).movedy=0
enemies(num).health=health
enemies(num).etype$=etype$
endfunction num
function deleteenemy(enemynum)
for c=enemynum to array count(enemies(0))-2
enemies(c).x=enemies(c+1).x
enemies(c).y=enemies(c+1).y
enemies(c).movedx=enemies(c+1).movedx
enemies(c).movedy=enemies(c+1).movedy
enemies(c).health=enemies(c+1).health
enemies(c).etype$=enemies(c+1).etype$
next c
dim enemies(array count(enemies(0))-1) as tower
endfunction
function addbullet(startx,starty,endx,endy,ttype)
num= array count(bullets(0))
dim bullets(num+1) as bullet
bullets(num).startx=startx
bullets(num).starty=starty
bullets(num).endx=endx
bullets(num).endy=endy
select ttype
case 1
bullets(num).btype$="·"
endcase
case 2
bullets(num).btype$="*"
endcase
case 3
bullets(num).btype$="("
endcase
endselect
endfunction num
function deletebullet(bulletnum)
for c=bulletnum to array count(bullets(0))-2
bullets(c).startx=bullets(c+1).startx
bullets(c).starty=bullets(c+1).starty
bullets(c).endx=bullets(c+1).endx
bullets(c).endy=bullets(c+1).endy
bullets(c).btype$=bullets(c+1).btype$
next c
dim bullets(array count(bullets(0))-1) as bullet
endfunction
As ever, it's not in the slightest way tidy, but it does the job. If anyone needs better instructions on how to play just ask. If I can I might try and squeeze some more levels in later, before the deadline, there's only 15 at the moment.