Here is my ASCII shooter i've been working on for a while. the boss shoots, there's a final score screen, and it's working well. i would appreciate any feedback, and i would like to have some help with a way to make the enemy ships move in multiple patterns. i would like some input now that most of the basics are in.
rem **********************************************************************
rem symbol shooter!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem **********************************************************************
rem general "first thing in the program" stuff
sync on
sync rate 90
hide mouse
rem make press start screen
do
cls
rem if Enter, break menu
if returnkey()=1 then exit
rem tell the player to begin
set text size 70
ink rgb(20,255,20),0
center text 320,415,"Press Enter to Begin"
rem print title
title$="ASC-I"
ink rgb(255,255,128),0
center text 320,0,title$
rem instructions
rem bullet instructions
set text size 10
ink rgb(255,255,255),0
text 0,100,"Click the Left Mouse Button to Fire Main Gun"
ink rgb(255,0,0),0
text 0,120,"} = = ="
rem missle instructions
ink rgb(255,255,255),0
text 0,150,"Press the Space Bar to Fire a Missle"
ink rgb(255,128,20),0
text 0,165,"} -> ->"
rem movement instructions
ink rgb(255,255,255),0
text 0,190,"Move the mouse to pilot your ship"
ink rgb(0,255,0),0
text 0,205,"} }"
rem weapon level instructions
ink rgb(255,255,255),0
text 0,220,"Upgrade Your Weapons for Increased Firepower"
ink rgb(255,255,255),0
text 0,240,"Lv. 1: E-1337 Coil Gun"
ink rgb(25,255,255),0
text 0,255,"} . . . ."
ink rgb(255,255,255),0
text 0,270,"Lv. 2: Dual E-1337 Coil Guns"
ink rgb(25,255,255),0
text 0,285,"} : : : :"
ink rgb(255,255,255),0
text 0,300,"Lv. 3: Dual U-8312 Lasers"
ink rgb(255,25,25),0
text 0,315,"} = = = ="
ink rgb(255,255,255),0
text 0,345,"Lv. 1: Bodkin Missle"
ink rgb(255,128,0),0
text 0,360,"} >"
ink rgb(255,255,255),0
text 0,375,"Lv. 2: Arbalest Missle"
ink rgb(234,90,0),0
text 0,390,"} >"
text 0,390,"} -"
ink rgb(255,255,255),0
text 0,405,"Lv. 3: Ballista Missle"
ink rgb(255,10,10),0
text 0,420,"} >"
text 0,420,"} -"
text 0,420,"} +"
rem powerup instructions
ink rgb(190,190,190),0
text 300,85,"Powerups"
ink rgb(128,255,128),0
text 300,100,"[$] : Point Reward"
ink rgb(255,255,20),0
text 300,120,"[*] : Replenishes One Missle"
ink rgb(28,233,28),0
text 300,140,"[+] : Restores Health"
ink rgb(255,10,10),0
text 300,160,"[=] : Lazer Upgrade"
ink rgb(240,55,13),0
text 300,180,"[>] : Missle Upgrade"
ink rgb(10,10,255),0
text 300,200,"[O] : Restores Shields"
rem enemy instructions
ink rgb(255,255,255),0
text 300,300,"Enemy Fighter Classes:"
ink rgb(255,88,24),0
text 360,325,"}"
ink rgb(255,50,50),0
text 380,325," : : : :"
ink rgb(123,100,20),0
text 300,350,">"
text 304,350,"-"
ink rgb(200,200,200),0
text 325,340,">"
text 325,350,">"
text 325,360,">"
ink rgb(30,123,255),0
text 360,375,"D"
ink rgb(255,20,255),0
text 385,375,"~"
text 385,385,"~"
sync
loop
rem set up game arrays
dim spriteposx(1000)
dim spriteposy(1000)
dim weaponready(1000)
dim powerupready(1000)
dim spritehealth(1000)
dim score(0)
dim bulletspeedy(1000)
rem accomplishment array
`(1) is debris killed
`(2) is ships killed
`(3) is boss bonus
`(4) is loot collected
`(5) is ammo bonus
`(6) is salvage bonus
dim accomplishment(10)
rem set up sprite image array
dim spriteimage(1000)
rem set up particle arrays
dim particleposx(100,8)
dim particleposy(100,8)
dim particleactive(100)
dim particlelife(100)
dim particlemaxlife(100)
dim particlecolor(100)
dim currentparticle(1)
currentparticle(1)=1
rem initialize series variables
ship=1
shield=2
firstbullet=3
lastbullet=30
firstmissle=31
lastmissle=35
firstindicator=36
lastindicator=40
dim firstpowerup(1)
dim lastpowerup(1)
firstpowerup(1)=41
lastpowerup(1)=65
firstpowerup=41
lastpowerup=65
firstdebris=71
lastdebris=90
firstenemy=91
lastenemy=126
boss=150
firstbossbullet=boss+5
lastbossbullet=firstbossbullet+50
firststar=1
laststar=25
rem set up star arrays
dim starposx(laststar)
dim starposy(laststar)
dim starcolor(laststar)
rem what sprites use what images
`the ship uses images 1, 2, and 3 for 1hp,2hp, and 3hp respectively
`the bullets(lasers) use images 4,5 and 6 for lvls 1, 2, and 3
`the missles use images 7,8, and 9 for lvls 1, 2, and 3
`the ammo indicator uses image 10
`powerups use the following:
`points are image 11
`health is image 12
`ammo is image 13
`missle upgrade is image 14
`gun upgrade is image 15
`shield pickup is image 16
`debris objects use images 17,18,19,and 20 for the different designs
`the shield (for player and enemies) is image 21
`the bullet enemy ship is image 22
`the missle enemy ship is image 23
`the shield enemy ship is image 24
`the bullet ship bullet is image 25
`the missle ship bullet is image 26
`the shield ship bullet is image 27
`the boss uses images 28, 29, 30, and 31 for flash, low hp, med hp,
`and high hp, respectively
`boss bullet uses image 32
rem images for debris sprites
numberofeach=int((lastdebris-firstdebris)/4)
for s=firstdebris to (firstdebris + numberofeach)
spriteimage(s)=17
next s
for s=(firstdebris+1+numberofeach) to (firstdebris + 2*numberofeach)
spriteimage(s)=18
next s
for s=(firstdebris + 1 + 2*numberofeach) to firstdebris+3*numberofeach
spriteimage(s)=19
next s
for s=firstdebris+1+numberofeach*3 to lastdebris
spriteimage(s)=20
next s
rem images for enemy ship sprites
spriteimage(firstenemy)=22
spriteimage(firstenemy+6)=22
spriteimage(firstenemy+12)=23
spriteimage(firstenemy+18)=23
spriteimage(firstenemy+24)=24
spriteimage(firstenemy+30)=24
rem images for enemy bullets
for x=firstenemy to lastenemy step 6
spriteimage(x+2)=spriteimage(x)+3
spriteimage(x+3)=spriteimage(x)+3
spriteimage(x+4)=spriteimage(x)+3
spriteimage(x+5)=spriteimage(x)+3
next x
rem load images~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rem load up player ship symbols
rem low hp
set text size 10
ink rgb(255,0,0),rgb(0,0,0)
text 0,0,"}"
get image 1,0,0,10,16
cls
rem med hp
ink rgb(255,255,0),rgb(0,0,0)
text 0,0,"}"
get image 2,0,0,10,16
cls
rem full hp
ink rgb(0,255,0),rgb(0,0,0)
text 0,0,"}"
get image 3,0,0,10,16
cls
rem load bullet sprites
rem lvl1
ink rgb(25,255,255),0
text 0,0,"."
get image 4,0,4,10,19
cls
rem lvl2
ink rgb(25,255,255),0
text 0,0,":"
get image 5,0,1,10,16
cls
rem lvl3
ink rgb(255,25,25),rgb(0,0,0)
text 0,0,"="
get image 6,0,0,10,15
cls
rem load missle sprites
rem missle lvl 1
ink rgb(255,128,0),0
text 0,0,">"
get image 7,0,0,10,15
cls
rem missle lvl 2
ink rgb(234,90,0),0
text 0,0,">"
text 0,0,"-"
get image 8,0,0,10,15
cls
rem missle lvl 3
ink rgb(255,10,10),0
text 0,0,">"
text 0,0,"-"
text 0,0,"+"
get image 9,0,0,10,15
cls
rem load missle ammo display sprite
ink rgb(255,255,0),rgb(0,0,0)
text 0,0,"*"
get image 10,0,0,10,15
cls
rem load powerup sprites
rem points
ink rgb(128,255,128),0
text 0,0,"[$]"
get image 11,0,0,30,15
cls
rem health
ink rgb(28,233,28),0
text 0,0,"[+]"
get image 12,0,0,30,15
cls
rem ammo pickup
ink rgb(255,255,20),0
text 0,0,"[*]"
get image 13,0,0,30,15
cls
rem missle upgrade
ink rgb(240,55,13),0
text 0,0,"[>]"
get image 14,0,0,30,15
cls
rem gun upgrade
ink rgb(255,10,10),0
text 0,0,"[=]"
get image 15,0,0,30,15
cls
rem shield pickup
ink rgb(10,10,255),0
text 0,0,"[O]"
get image 16,0,0,30,15
cls
rem load up debris sprites
ink rgb(128,128,255),0
text 0,0,"/"
get image 17,0,0,10,15
cls
ink rgb(100,100,200),0
text 0,0,""
get image 18,0,0,10,15
cls
ink rgb(123,120,140),0
text 0,0,"|"
get image 19,0,0,10,15
cls
ink rgb(120,130,200),0
text 0,0,"'"
get image 20,0,0,10,15
cls
rem load shield sprite
set text size 10
ink rgb(20,24,255),0
text 0,0,")"
get image 21,0,0,10,16
cls
rem load up enemy ship sprites
rem bullet ship
ink rgb(255,88,24),0
text 0,0,"}"
get image 22,0,0,10,16
cls
rem missle ship
ink rgb(123,100,20),0
text 0,0,">"
text 4,0,"-"
get image 23,0,0,10,15
cls
rem shield ship
ink rgb(30,123,255),0
text 0,0,"D"
get image 24,0,0,10,15
cls
rem load up enemy bullet sprites
rem bullet ship bullet
ink rgb(255,50,50),0
text 0,0,":"
get image 25,0,0,10,15
cls
rem missle ship bullet
ink rgb(200,200,200),0
text 0,0,"<"
get image 26,0,0,10,15
cls
rem shield ship bullet
ink rgb(255,20,255),0
text 0,0,"~"
get image 27,0,0,5,5
cls
rem rem load up boss sprites
rem >50% hp
ink rgb(25,25,255),0
text 0,1," /"
text 9,3,"-"
text 9,27,"-"
text 0,15,"<"
text 6,14,"{"
text 11,14,"x"
text 19,14,"["
text 22,14,":"
text 0,28," "
get image 31,0,0,30,45
cls
rem <50% hp
ink rgb(255,128,25),0
text 0,1," /"
text 9,3,"-"
text 9,27,"-"
text 0,15,"<"
text 6,14,"{"
text 11,14,"x"
text 19,14,"["
text 22,14,":"
text 0,28," "
get image 30,0,0,30,45
cls
rem <25% hp
ink rgb(255,55,25),0
text 0,1," /"
text 9,3,"-"
text 9,27,"-"
text 0,15,"<"
text 6,14,"{"
text 11,14,"x"
text 19,14,"["
text 22,14,":"
text 0,28," "
get image 29,0,0,30,45
cls
rem flashing sprite for <10% hp
ink rgb(255,255,255),0
text 0,1," /"
text 9,3,"-"
text 9,27,"-"
text 0,15,"<"
text 6,14,"{"
text 11,14,"x"
text 19,14,"["
text 22,14,":"
text 0,28," "
get image 28,0,0,30,45
cls
rem make boss bullet sprite
ink rgb(255,90,0),0
text 0,0,"."
get image 32,0,0,10,15
cls
rem prepare sprites}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
rem prepare ship
sprite 1,40,mousey(),1
show sprite 1
size sprite 1,50,30
rem prepare bullets
for x=firstbullet to lastbullet
weaponready(x)=1
spriteposy(x)=-60
sprite x,spriteposx(x),spriteposy(x),1
size sprite x,20,30
next x
rem prepare missles
for y=firstmissle to lastmissle
weaponready(y)=1
spriteposy(y)=-60
sprite y,spriteposx(y),spriteposy(y),7
size sprite y,20,30
next y
rem prepare powerups
for p=firstpowerup to lastpowerup
spriteposy(p)=-30
powerupready(p)=1
sprite p,spriteposx(p),spriteposy(p),11
show sprite p
next p
rem prepare debris
for d=firstdebris to lastdebris
spriteposx(d)=rnd(2000)+2100
spriteposy(d)=rnd(480)
sprite d,spriteposx(d),spriteposy(d),spriteimage(d)
size sprite d,30,45
show sprite d
spritehealth(d)=1
next d
rem prepare shield
spriteposx(2)=60
sprite 2,0,0,21
size sprite 2,25,45
hide sprite 2
cls
rem prepare enemy ships, shields and bullets
rem shield is x+1,bullets are x+2,x+3, and x+4
for e=firstenemy to lastenemy step 6
rem make ship
spriteposy(e)=rnd(480)
spriteposx(e)=1100+rnd(2000)
sprite e,spriteposx(e),spriteposy(e),spriteimage(e)
mirror sprite e
size sprite e,20,30
show sprite e
if spriteimage(e)=22 then spritehealth(e)=4
if spriteimage(e)=23 then spritehealth(e)=5
if spriteimage(e)=24 then spritehealth(e)=4
rem make shield (e+1)
spriteposx(e+1)=spriteposx(e)-12
spriteposy(e+1)=spriteposy(e)
sprite e+1,spriteposx(e+1),spriteposy(e+1),21
size sprite e+1,20,30
mirror sprite e+1
show sprite e+1
if spriteimage(e)=22 then spritehealth(e+1)=4
if spriteimage(e)=23 then spritehealth(e+1)=5
if spriteimage(e)=24 then spritehealth(e+1)=5
rem make bullets (e+2,3,4,5)
for b=2 to 5
spriteposx(e+b)=spriteposx(e)
spriteposy(e+b)=spriteposy(e)
sprite e+b,spriteposx(e+b),spriteposy(e+b),spriteimage(e+b)
size sprite e+b,20,30
show sprite e+b
weaponready(e+b)=1
next b
next e
rem prepare boss
spriteposx(boss)=640
spriteposy(boss)=100
sprite boss,spriteposx(boss),spriteposy(boss),28
size sprite boss,300,300
hide sprite boss
rem prepare boss shield(boss+4)
sprite boss+4,spriteposx(boss)-100,spriteposy(boss),21
mirror sprite boss+4
spritehealth(boss+4)=500
hide sprite boss+4
size sprite boss+4,100,300
weaponready(boss)=0
rem prepare boss bullets
for u=firstbossbullet to lastbossbullet
weaponready(u)=1
sprite u,700,-100,32
size sprite u,40,60
bulletspeedy(u)=(rnd(2)-1)+(rnd(2)-1)
next u
rem make and set up star background
for r=firststar to laststar
starposx(r)=rnd(640)
starposy(r)=rnd(480)
starcolor(r)=rgb(255,255,255-4*r)
next r
rem initialize variables
health=3
bullvl=3
msllvl=1
ammo=3
shields=1
msldmg=59
buldmg=2
timetoboss=60000
bossfight=0
spritehealth(boss)=1000
bossmaxhealth=1000
textx=640
announcement$="Approaching Enemy Sector"
energymax#=100
energy#=energymax#
energyrecharge#=.3
energycost#=8
rem make "start time" variable, to track time elapsed
starttime=timer()
``````````````````````````````````````````````````````````````````````````
rem main game loop )))))))))))))))))))))))))))))))))))))))))))))))))))))))
``````````````````````````````````````````````````````````````````````````
do
cls
rem print ammo indicator
ink rgb(255,255,0),0
print "AMMO:"
rem print score
ink rgb(244,244,90),0
print "SCORE:" ; score(0)
rem print energy bar
set text size 10
ink rgb(20,255,30),0
box 0,50,energy#,61
ink rgb(255,0,255),0
center text 50,48,"ENERGY"
if energy#<=energymax# then energy#=energy#+energyrecharge#
rem print frame rate
print "Sync rate:" ; screen fps()
rem print announcements
if textx>-300
ink rgb(255,10,10),0
set text size 70
textx=textx-4
center text textx,100,announcement$
endif
rem declare mouseclick variable
mouseclick=mouseclick()
if mousex()>200 then position mouse 200,mousey()
spriteposx(ship)=mousex()
spriteposy(ship)=mousey()
rem draw star background
inc g
if g>4 then g=0
for r=firststar to laststar
if g=0 then starposx(r)=starposx(r)-1
if starposx(r)<=0 then starposx(r)=640 : starposy(r)=rnd(480)
ink starcolor(r),0
dot starposx(r),starposy(r)
next r
rem check time
rem check for bossfight start
if timer()-starttime>timetoboss and spritehealth(boss)>0
bossfight=1
show sprite boss+4
show sprite boss
endif
rem check time for bosskill score screen
if timer()-bosskilltime>2000 and spritehealth(boss)<=0
accomplishment(5)=ammo
for s=1 to 300
if sprite exist(s)=1 then delete sprite s
next s
cls
sync
scorescreen()
endif
if timer()-deathtime>2000 and deathtime<>0
for s=1 to 300
if sprite exist(s)=1 then delete sprite s
next s
cls
sync
scorescreen()
endif
rem draw ship
sprite 1,mousex(),mousey(),health
rem if dead, kill player
if health<=0
if deathtime=0
deathtime=timer()
particle(mousex(),mousey(),50,rgb(255,255,255))
particle(mousex()+15,mousey(),50,rgb(255,255,255))
particle(mousex(),mousey()+15,50,rgb(255,255,255))
particle(mousex()+15,mousey()+15,50,rgb(255,255,255))
particle(mousex()+7,mousey()+7,50,rgb(255,255,255))
endif
set text size 70
center text 320,240,"Your Head A Splode"
set text size 10
endif
rem draw shield
if shields=1 then show sprite shield else hide sprite shield
sprite shield,spriteposx(ship)+20,mousey()-8,21
rem manage bullets
justshot=justshot-1
if justshot<=0 then justshot=0
for x=firstbullet to lastbullet
if mouseclick=1 and justshot=0 and energy#>energycost#
if weaponready(x)=1
energy#=energy#-energycost#
spriteposy(x)=mousey()+3
spriteposx(x)=spriteposx(ship)
weaponready(x)=0
show sprite x
justshot=9
endif
endif
rem move bullet
if weaponready(x)=0
spriteposx(x)=spriteposx(x)+3
show sprite x
if spriteposx(x)>660 then resetbullet(x)
rem check for debris collision
for o=firstdebris to lastdebris
if sprite collision(x,o)=1
resetbullet(x)
spritehealth(o)=spritehealth(o)-(buldmg^bullvl)
endif
next o
rem check for collision with boss
if bossfight=1
for bosspart=boss to boss+4
if sprite exist(bosspart)=1
rem check for collision with bossparts and shield
if sprite collision(bosspart,x)=1 and spritehealth(bosspart)>0
spritehealth(bosspart)=spritehealth(bosspart)-(buldmg^bullvl)
resetbullet(x)
endif
endif
next bosspart
endif
rem check for enemy ship/shield collision
for s=firstenemy to lastenemy step 6
rem damage enemy shield
if sprite collision(s+1,x)=1 and spritehealth(s+1)>0
resetbullet(x)
spritehealth(s+1)=spritehealth(s+1)-(buldmg^bullvl)
endif
rem damage enemy ship
if sprite collision(s,x)=1
resetbullet(x)
spritehealth(s)=spritehealth(s)-(buldmg^bullvl)
endif
next s
endif
rem draw bullet
sprite x,spriteposx(x),spriteposy(x),(bullvl+3)
next x
rem manage missles
justshotmsl=0
rem if conditions right, fire missle
for y=firstmissle to lastmissle
if spacekey()=1 and lls=0 and justshotmsl=0 and ammo>0
if weaponready(y)=1
spriteposy(y)=mousey()
spriteposx(y)=spriteposx(ship)
weaponready(y)=0
justshotmsl=1
dec ammo
show sprite y
endif
endif
rem move missle
if weaponready(y)=0
show sprite y
spriteposx(y)=spriteposx(y)+5
if spriteposx(y)>660 then resetmissle(y)
rem check for debris collision
for s=firstdebris to lastdebris
if sprite collision(y,s)=1 then killdebris(s,1)
next s
rem check for collision with boss
if bossfight=1
for bosspart=boss to boss+4
if sprite exist(bosspart)=1
rem check for collision with bossparts/shield
if sprite collision(bosspart,y)=1 and spritehealth(bosspart)>0
spritehealth(bosspart)=spritehealth(bosspart)-(msldmg*msllvl)
resetmissle(y)
endif
endif
next bosspart
endif
rem check for enemy collision
for s=firstenemy to lastenemy step 6
rem check for collision with enemy shield
if sprite collision(s+1,y)=1 and spritehealth(s+1)>0
rem damage enemy shield
spritehealth(s+1)=spritehealth(s+1)-(msldmg^msllvl)
rem lvl2,3 missles pierce shields
if msllvl=1 then resetmissle(y)
endif
rem damage enemy ship
if sprite collision(s,y)=1
rem lvl3 missles pierce ships
if msllvl<3 then resetmissle(y)
spritehealth(s)=spritehealth(s)-(msldmg*msllvl)
endif
next s
endif
rem draw missle
sprite y,spriteposx(y),spriteposy(y)+7,(msllvl+6)
next y
rem manage ammo counter
for a=1 to 5
rem draw ammo counter (one * for each missle)
sprite (firstindicator-1)+a,(40+(10*a)),((ammo+1<=a)*-15),10
next a
rem manage powerups
for p=firstpowerup to lastpowerup
if powerupready(p)=0
spriteposx(p)=spriteposx(p)-1
if spriteposx(p)<-10 then powerupready(p)=1 : spriteposy(p)=-30
endif
rem check for powerup collision
if sprite collision(p,1)=1
powerupready(p)=1
spriteposy(p)=-30
rem decide what powerup to award
if sprite image(p)=11 then score(0)=score(0)+150 : accomplishment(4)=accomplishment(4)+1
if sprite image(p)=12 and health<3 then inc health : score(0)=score(0)+5 : accomplishment(6)=accomplishment(6)+1
if sprite image(p)=13 and ammo<5 then inc ammo : score(0)=score(0)+5 : accomplishment(6)=accomplishment(6)+1
if sprite image(p)=14 and msllvl<3 then inc msllvl : score(0)=score(0)+5 : accomplishment(6)=accomplishment(6)+1
if sprite image(p)=15 and bullvl<3 then inc bullvl : score(0)=score(0)+5 : accomplishment(6)=accomplishment(6)+1
if sprite image(p)=16 then shields=1 : score(0)=score(0)+5 : accomplishment(6)=accomplishment(6)+1
endif
sprite p,spriteposx(p),spriteposy(p),sprite image(p)
next p
rem manage debris
for d=firstdebris to lastdebris
rem move debris
spriteposx(d)=spriteposx(d)-4
rem q variable to allow fractional y position
q=q+1
if q=5
rem if debris on screen, make go up/down
if spriteposx(d)<640
rem if in first 1/3 of debris #'s, go up
if (d-firstdebris)<(lastdebris-firstdebris)/3
spriteposy(d)=spriteposy(d)-1
endif
rem if in last 1/3 of debris #'s, go down
if (d-firstdebris)>(lastdebris-firstdebris)/3*2
spriteposy(d)=spriteposy(d)+1
endif
endif
q=0
endif
rem check for dead debris
if spritehealth(d)<=0 then killdebris(d,1)
rem reseed debris if nesecary
if spriteposx(d)<0 then killdebris(d,0)
rem check for collision with player
if sprite collision(ship,d)=1
dec health
killdebris(d,0)
endif
rem check for collision with shield
if sprite collision(shield,d)=1 and shields=1
shields=0
killdebris(d,0)
endif
rem check for collision with boss
if sprite collision(d,boss)=1 and bossfight=1
killdebris(d,0)
endif
rem draw debris
sprite d,spriteposx(d),spriteposy(d),spriteimage(d)
next d
rem manage enemy ships
for e=firstenemy to lastenemy step 6
rem move enemies
if bossfight=0
spriteposy(e)=sin(timer()/30+3*e)^9*240+240
else
spriteposy(e)=curvevalue(-300,spriteposy(e),70)
endif
spriteposx(e)=spriteposx(e)-1
rem if enemy ship dead, drop powerups and increase score
if spritehealth(e)<=0 then killenemy(e)
rem check for collision with player
if sprite collision(ship,e)=1
health=health-1
killenemy(e)
endif
rem check for collision with shield
if sprite collision(shield,e)=1
shields=0
killenemy(e)
endif
rem reseed enemies if necesary
if spriteposx(e)<0 then spriteposx(e)=rnd(360)+640
rem make enemies shoot
rem increment a "ready to shoot the next bullet" variable
if spriteposx(e)<640 then weaponready(e)=weaponready(e)+1
if weaponready(e)=200 then weaponready(e)=0
for b=2 to 5
rem if weapon ready, position on ship and hide bullet
if weaponready(e+b)=1
spriteposx(e+b)=spriteposx(e)
spriteposy(e+b)=spriteposy(e)
hide sprite b+e
endif
rem if bullet ship ready to fire that bullet,
rem realease it and make unready
if spriteimage(e)=22
if weaponready(e)=20*b
weaponready(e+b)=0
endif
endif
rem if missle ship ready to fire all bullets,
rem release all and make unready
if spriteimage(e)=23
if weaponready(e)=40
weaponready(e+1)=0
weaponready(e+2)=0
weaponready(e+3)=0
weaponready(e+4)=0
endif
endif
rem if wave ship ready to fire bullet pair,
rem release pair and make unready
if spriteimage(e)=24
if weaponready(e)=50
weaponready(e+2)=0
weaponready(e+3)=0
endif
if weaponready(e)=150
weaponready(e+4)=0
weaponready(e+5)=0
endif
endif
rem if unready(ie, already shot) move it, etc.
if weaponready(e+b)=0
spriteposx(e+b)=spriteposx(e+b)-5
show sprite e+b
rem if bullet offscreen, make ready again
if spriteposx(e+b)<0
weaponready(e+b)=1
hide sprite e+b
endif
rem check for collision with player
if sprite collision(ship,e+b)=1
health=health-1
spriteposx(e+b)=spriteposx(e)
weaponready(e+b)=1
hide sprite e+b
endif
rem check for collision with shields
if sprite collision(shield,e+b)=1 and shields=1
shields=0
spriteposx(e+b)=spriteposx(e)
weaponready(e+b)=1
hide sprite e+b
endif
rem check for collision with debris
for w=firstdebris to lastdebris
if sprite collision(e+b,w)=1
if spriteimage(e+b)<>26
weaponready(e+b)=1
hide sprite e+b
endif
rem reposition debris sprite
particle(spriteposx(w),spriteposy(w),10,rgb(255,128,0))
spriteposx(w)=rnd(360)+640
spriteposy(w)=rnd(480)
endif
next w
rem check for collision with player bullet
for L=firstmissle to lastmissle
if sprite collision(L,e+b)=1
hide sprite e+b
weaponready(e+b)=1
particle(spriteposx(e+b),spriteposy(e+b),5,rgb(255,30,70))
spriteposx(e+b)=spriteposx(e)
endif
next L
endif
rem draw bullet
rem calculations for wave effect
wave=(spriteimage(e+b)=27)*40*sin((timer()/5)+(180*b))
rem calculations for spreadfire effect
spread=(spriteimage(e+b)=26)*(b-3)
spriteposy(b+e)=spriteposy(e+b)+spread
sprite b+e,spriteposx(b+e),spriteposy(b+e)+wave,spriteimage(b+e)
next b
rem manage enemy shield
spriteposx(e+1)=spriteposx(e)-17
spriteposy(e+1)=spriteposy(e)-1
if spritehealth(e+1)>0
sprite e+1,spriteposx(e+1),spriteposy(e+1),21
else
hide sprite e+1
endif
rem draw enemy sprites
sprite e,spriteposx(e),spriteposy(e),spriteimage(e)
next e
rem manage boss
if bossfight=1
show sprite boss
rem if almost dead ,every other loop, change flash
if spritehealth(boss)<bossmaxhealth/10
t=1-t
if t=1 then flash=1-flash
endif
rem kill boss when out of health
if spritehealth(boss)<=0 and bossfight=1
bossfight=0
killboss(boss)
bosskilltime=timer()
rem kill enemies to reset them
for z=firstenemy to lastenemy step 6
killenemy(z)
next z
endif
rem determine which image to use
spriteimage(boss)=28+flash+(spritehealth(boss)>bossmaxhealth/2)+(spritehealth(boss)>bossmaxhealth/4)+(spritehealth(boss)>bossmaxhealth/10)
rem move boss
spriteposy(boss)= 90+90*sin(timer()/20)
spriteposx(boss)=curvevalue(340,spriteposx(boss),200)
rem manage boss bullets
weaponready(boss)=weaponready(boss)+1
if weaponready(boss)=>400 then weaponready(boss)=0
for u=firstbossbullet to lastbossbullet
if weaponready(u)=1 then spriteposx(u)=700
rem fire bullet at the correct time
if weaponready(boss)=(u-boss-5)*8 and weaponready(u)=1
weaponready(u)=0
spriteposx(u)=spriteposx(boss)
spriteposy(u)=spriteposy(boss)+100+50*rnd(2)
endif
rem if unready then move bullet
if weaponready(u)=0
spriteposx(u)=spriteposx(u)-5
spriteposy(u)=spriteposy(u)+bulletspeedy(u)
show sprite u
if spriteposx(u)<-50 then weaponready(u)=1
rem check for collision with player
if sprite collision(ship,u)=1
dec health
weaponready(u)=1
spriteposx(u)=700
endif
rem check for collision with shield
if sprite collision(shield,u)=1 and shields=1
shields=0
weaponready(u)=1
spriteposx(u)=700
endif
endif
rem draw boss sprite
sprite u,spriteposx(u),spriteposy(u),32
next u
rem manage boss shield
if spritehealth(boss+4)<=0 then hide sprite boss+4
sprite boss+4,spriteposx(boss)-100,spriteposy(boss)-25,21
rem draw boss sprite
sprite boss,spriteposx(boss)+10*cos(timer()/10),spriteposy(boss),spriteimage(boss)
endif
rem update particles
updateparticles()
rem store last loop variables
llc=mouseclick()
lls=spacekey()
rem refresh screen
sync
loop
rem functions***************************************************************
rem releasepowerup function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function releasepowerup(c,x,y)
rem if its a random drop, release a determined powerup
if c<25
rem drop a points
if c>0 and c<10 then image=11
rem drop a hp pickup
if c>10 and c<15 then image=12
rem drop an ammo refill
if c>15 and c<20 then image=13
rem drop weapon upgrade
if (c-20)*(c-21)=0 then image=14
rem drop missle upgrade
if (c-22)*(c-23)=0 then image=15
rem drop shield restore
if (c-24)*(c-25)=0 then image=16
for o=firstpowerup(1) to lastpowerup(1)
if powerupready(o)=1
sprite o,x,y,image
powerupready(o)=0
spriteposx(o)=x
spriteposy(o)=y
exit
endif
next o
endif
rem if its a defined drop, drop the defined powerup
if c>100
rem if c=101 then drop missle upgrade
if c=101 then image=15
rem if c=102 then drop gun upgrade
if c=102 then image=14
rem if c=103 then drop shield powerup
if c=103 then image=16
for o=firstpowerup(1) to lastpowerup(1)
if powerupready(o)=1
sprite o,x,y,image
powerupready(o)=0
spriteposx(o)=x
spriteposy(o)=y
exit
endif
next o
endif
endfunction
rem initiate particle function&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
rem x=position x, y= position y, s=size/strength, c=color
function particle(x,y,s,c)
rem position particles at location
for p=1 to 8
particleposx(currentparticle(1),p)=x
particleposy(currentparticle(1),p)=y
next p
particlecolor(currentparticle(1))=c
rem activate particles, give life
particleactive(currentparticle(1))=1
particlemaxlife(currentparticle(1))=s
particlelife(currentparticle(1))=particlemaxlife(currentparticle(1))
currentparticle(1)=currentparticle(1)+1
if currentparticle(1)=>100 then currentparticle(1)=1
endfunction
rem particle update function@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function updateparticles()
for n=1 to 100
if particleactive(n)=1
ink particlecolor(n),0
rem dec life
particlelife(n)=particlelife(n)-1
rem draw particle
for p=1 to 8
dot particleposx(n,p)+(particlemaxlife(n)-particlelife(n))*cos(45*p),particleposy(n,p)+(particlemaxlife(n)-particlelife(n))*sin(45*p)
next p
rem deactiveate dead particle
if particlelife(n)<=0 then particleactive(n)=0
endif
next n
endfunction
rem 2d distance function****************************************************
rem for 2 objects whose coordinates are (x,y) and (a,b)
function distance(x,y,a,b)
r=(x-a)^2
s=(y-b)^2
d=sqrt(r+s)
endfunction d
rem kill enemy function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem does all the required things when an enemy dies, reseeds pos, resets hp,
rem and awards an appropriate powerup
function killenemy(e)
releasepowerup(spriteimage(e)+79,spriteposx(e),spriteposy(e))
score(0)=score(0)+100 : accomplishment(2)=accomplishment(2)+1
rem do a spectactular particle effect
particle(spriteposx(e)+12,spriteposy(e),40,rgb(255,128,0))
particle(spriteposx(e),spriteposy(e),40,rgb(255,128,0))
particle(spriteposx(e),spriteposy(e)+12,40,rgb(255,128,0))
particle(spriteposx(e)+12,spriteposy(e)+12,40,rgb(255,128,0))
spritehealth(e)=50
spritehealth(e+1)=50
show sprite e
show sprite e+1
spriteposx(e)=rnd(660)+640
spriteposx(e+1)=spriteposx(e)-12
endfunction
rem kill boss function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem does all the nececary things to kill a boss, massive particle,
rem and reposition
function killboss(boss)
rem massive particle effect
particle(spriteposx(boss)+0,spriteposy(boss)+100,150,rgb(255,24,0))
particle(spriteposx(boss)+150,spriteposy(boss)+100,150,rgb(255,24,0))
particle(spriteposx(boss)+300,spriteposy(boss)+100,150,rgb(255,24,0))
particle(spriteposx(boss)+0,spriteposy(boss)+150,150,rgb(255,24,0))
particle(spriteposx(boss)+150,spriteposy(boss)+150,150,rgb(255,24,0))
particle(spriteposx(boss)+300,spriteposy(boss)+150,150,rgb(255,24,0))
particle(spriteposx(boss)+0,spriteposy(boss)+200,150,rgb(255,24,0))
particle(spriteposx(boss)+150,spriteposy(boss)+200,150,rgb(255,24,0))
particle(spriteposx(boss)+300,spriteposy(boss)+200,150,rgb(255,24,0))
rem hide sprite and reposition
spriteposx(boss)=700
hide sprite boss
score(0)=score(0)+1000
accomplishment(3)=accomplishment(3)+1
endfunction
rem kill debris function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem kills and reseeds a debris object, and adds score if killed by player
function killdebris(debris,p)
spritehealth(debris)=1
if p=1 then score(0)=score(0)+1 : accomplishment(1)=accomplishment(1)+1
rem seed random drop
if p=1 then releasepowerup(rnd(100),spriteposx(debris),spriteposy(debris))
rem reposition debris sprite
particle(spriteposx(debris),spriteposy(debris),10,rgb(255,128,0))
spriteposx(debris)=rnd(360)+640
spriteposy(debris)=rnd(480)
endfunction
rem reset bullet function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem makes a bullet ready, hides it, and repositions it, and a particle
function resetbullet(bullet)
weaponready(bullet)=1
hide sprite bullet
particle(spriteposx(bullet),spriteposy(bullet),10,rgb(255,10,10))
spriteposx(bullet)=mousex()
spriteposy(bullet)=mousey()
endfunction
rem reset missle function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function resetmissle(missle)
weaponready(missle)=1
hide sprite missle
particle(spriteposx(missle),spriteposy(missle),20,rgb(255,110,10))
spriteposx(missle)=mousex()
spriteposy(missle)=mousey()
endfunction
rem score screen function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function scorescreen()
do
cls
rem print score details
set text size 10
ink rgb(255,128,0),0
center text 320,0,"Your Score:"
center text 320,50,"Debris Destroyed x " + str$(accomplishment(1)) + " = " + str$(1*accomplishment(1))
center text 320,75,"Enemy Ships Destroyed x " + str$(accomplishment(2)) + " = " + str$(100*accomplishment(2))
center text 320,100,"Boss Bonus x " + str$(accomplishment(3)) + " = " + str$(1000*accomplishment(3))
center text 320,125,"Loot Collected x " + str$(accomplishment(4)) + " = " + str$(150*accomplishment(4))
center text 320,150,"Ammo Bonus x " + str$(accomplishment(5)) + " = " + str$(100*accomplishment(5))
center text 320,175,"Salvage Bonus x " + str$(accomplishment(6)) + " = " + str$(5*accomplishment(6))
line 100,198,540,198
set text size 70
totalscore = 1*accomplishment(1) + 100*accomplishment(2) + 1000*accomplishment(3) + 150*accomplishment(4) + 100*accomplishment(5) + 5*accomplishment(6)
center text 320,200,"TOTAL SCORE: " + str$(totalscore)
rem print rating]
set text size 60
if totalscore<1000 then rating$="Suxxorz" : ink rgb(255,128,128),0
if totalscore>1000 then rating$="TeH RoXxOrZ" : ink rgb(123,100,20),0
if totalscore>2000 then rating$="Pwnage" : ink rgb(200,200,200),0
if totalscore>3000 then rating$="U83R L33T" : ink rgb(150,123,20),0
if totalscore>4000 then rating$="WTF, HAX!1!!!?" : ink rgb(200,200,250),0
center text 320,300,"Your Rating:" + rating$
rem quit
ink rgb(255,20,20),0
center text 320,400,"Press Esc to Quit"
if escapekey()=1 then end
sync
loop
endfunction
Truth suffers from too much analysis.
-Ancient Fremen Saying