it appears i posted a bad version of my program in the last post. here is the code for the shooter:
rem **********************************************************************
rem symbol shooter!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem **********************************************************************
rem an ASCII based space shooter by ShadowCentaur
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,"Left Click or Press the Spacebar 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,"Right Click or Press the Left Alt Key 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,"Use the Mouse or Arrow Keys to Pilot 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"
rem gun levels
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,"} = = = ="
rem missle levels
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 400,85,"Powerups:"
ink rgb(128,255,128),0
text 400,100,"[$] : Point Reward"
ink rgb(255,255,20),0
text 400,120,"[*] : Replenishes One Missle"
ink rgb(28,233,28),0
text 400,140,"[+] : Restores Health"
ink rgb(255,10,10),0
text 400,160,"[=] : Gun Upgrade"
ink rgb(240,55,13),0
text 400,180,"[>] : Missle Upgrade"
ink rgb(10,10,255),0
text 400,200,"[O] : Restores Shields"
rem enemy instructions
ink rgb(255,255,255),0
text 300,300,"Enemy Fighter Classes:"
rem bullet ship
ink rgb(255,88,24),0
text 360,325,"}"
ink rgb(255,50,50),0
text 380,325," : : : :"
rem missle ship
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,">"
rem wave ship
ink rgb(30,123,255),0
text 360,375,"D"
ink rgb(255,20,255),0
text 385,375,"~"
text 385,385,"~"
rem photon turret
ink rgb(0,255,128),0
text 450,320,"W-W"
ink rgb(255,128,128),0
text 460,340,"**"
rem arrow turret
ink rgb(78,139,34),0
text 450,380,"(Y)"
ink rgb(128,255,128),0
text 455,360,"^^"
rem hive turret
ink rgb(255,255,30),0
text 500,380,"3"
text 506,380,"="
text 508,380,"3"
ink rgb(128,128,255),0
text 480,380,"%"
sync
loop
rem load images~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rem load up player ship symbols
set text size 10
rem lo hp
ink rgb(255,0,0),rgb(0,0,0)
text 0,0,"}"
get image 1,0,1,10,17
cls
rem med hp
ink rgb(255,255,0),rgb(0,0,0)
text 0,0,"}"
get image 2,0,1,10,17
cls
rem full hp
ink rgb(0,255,0),rgb(0,0,0)
text 0,0,"}"
get image 3,0,1,10,17
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,18
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 7,3,"-"
text 9,27,"-"
text 7,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 7,3,"-"
text 9,27,"-"
text 7,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 7,3,"-"
text 9,27,"-"
text 7,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 7,3,"-"
text 9,27,"-"
text 7,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 make enemy turrets
rem make photon turret sprite
ink rgb(0,255,128),0
text 0,0,"W"
text 12,0,"-"
text 14,0,"W"
get image 33,0,0,32,15
cls
rem make arrow turret sprite
ink rgb(78,139,34),0
text 0,0,"(Y)"
get image 34,0,0,30,16
cls
rem make hive turret sprite
ink rgb(255,255,30),0
text 0,0,"3"
text 6,0,"="
text 8,0,"3"
get image 35,0,0,30,15
cls
rem make photon turret bullet sprite
ink rgb(255,128,128),0
text 3,0,"**"
get image 36,0,0,20,18
cls
rem make arrow turret bullet sprite
ink rgb(128,255,128),0
text 1,0,"^^"
get image 37,0,0,20,16
cls
rem make hive turret bullet sprite
ink rgb(128,128,255),0
text 4,2,"%"
get image 38,4,2,14,16
cls
rem array setup********************************************************
rem set up game arrays
dim spriteposx(2000)
dim spriteposy(2000)
dim weaponready(2000)
dim powerupready(2000)
dim spritehealth(2000)
dim score(0)
dim bulletspeedy(2000)
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
`(7) is ship bonus
dim accomplishment(10)
rem current level array(global variable) to keep track of current level
dim currentlevel(0)
currentlevel(0)=1
rem restart variable, to keep track of whether have restarted or not
dim restart(0)
restart(0)=0
rem map data array, for loading maps from a file
dim mapdata(2000)
rem levelscore array to keep track of score for each level beaten
dim levelscore(10)
rem set up sprite image array
dim spriteimage(2000)
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
goto main
rem point from which a level starts, will reload from here when go to next level
main:
dim mapdata(2000)
for x=1 to (2000-3)
mapdata(x)=0
mapdata(x+1)=0
mapdata(x+2)=0
mapdata(x+3)=0
next x
rem load map
mapname$="level"+str$(currentlevel(0))+".txt"
load array mapname$,mapdata(2000)
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=mapdata(1)
boss=1300
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
`photon turret uses image 33
`arrow turret uses image 34
`hive turret uses image 35
`photon turret bullet uses image 36
`arrow turret uses image 37
`hive turret bullet uses image 38
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 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,25,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,35,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 enemy
spriteposy(e)=mapdata(e+2)
spriteposx(e)=mapdata(e+1)
spriteimage(e)=mapdata(e+3)
sprite e,spriteposx(e),spriteposy(e),spriteimage(e)
rem enemy ships
if spriteimage(e)=22 or spriteimage(e)=23 or spriteimage(e)=24
if restart(0)=0 then mirror sprite e
size sprite e,20,30
show sprite e
if spriteimage(e)=22 then spritehealth(e)=4 : spritehealth(e+1)=4
if spriteimage(e)=23 then spritehealth(e)=5 : spritehealth(e+1)=5
if spriteimage(e)=24 then spritehealth(e)=4 : spritehealth(e+1)=5
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
if restart(0)=0 then mirror sprite e+1
show sprite e+1
rem make ship bullets (e+2,3,4,5)
for b=2 to 5
spriteposx(e+b)=spriteposx(e)
spriteposy(e+b)=spriteposy(e)
rem images for enemy bullets
spriteimage(e+b)=spriteimage(e)+3
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
endif
rem make turrets
if spriteimage(e)=33 or spriteimage(e)=34 or spriteimage(e)=35
size sprite e,60,20
if spriteimage(e)=33 then spritehealth(e)=20
if spriteimage(e)=34
spritehealth(e)=20
if restart(0)=0 then flip sprite e
endif
if spriteimage(e)=35 then spritehealth(e)=15
show sprite e
rem prepare turret bullets
for b=2 to 5
spriteposx(e+b)=spriteposx(e)
spriteposy(e+b)=spriteposy(e)
rem images for enemy bullets
spriteimage(e+b)=spriteimage(e)+3
sprite e+b,spriteposx(e+b),spriteposy(e+b),spriteimage(e+b)
size sprite e+b,60,40
if spriteimage(e)=35 then size sprite e+b,20,16
show sprite e+b
weaponready(e+b)=1
next b
endif
next e
rem prepare boss
spriteposx(boss)=mapdata(boss+1)
spriteposy(boss)=240
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
if restart(0)=0 then 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 ))))))))))))))))))))))))))))))))))))))))))))))))
lives=3
health=3
bullvl=1
msllvl=1
ammo=3
shields=1
msldmg=59
buldmg=2
shipspeed=5
timetoboss=60000
bossfight=0
spritehealth(boss)=1000
bossmaxhealth=1000
flash=0
q=0
gameovertime=0
deathtime=0
bosskilltime=0
spawning=0
textx=640
announcement$="Approaching Enemy Sector"
level$="LEVEL "+str$(currentlevel(0))
energymax#=100
energy#=energymax#
energyrecharge#=.3
energycost#=8
score(0)=0
for n=1 to 10
accomplishment(n)=0
next n
justshot=0
justshotmsl=0
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 lives
ink rgb(0,255,0),0
if lives=3 then print "LIVES: }}}"
if lives=2 then print "LIVES: }}"
if lives=1 then print "LIVES: }"
rem print framerate
text 0,70,"Sync rate:"+str$(screen fps())
rem print announcements
if textx>-400
ink rgb(255,10,10),0
set text size 70
textx=textx-4
center text textx,100,announcement$
center text textx,200,level$
endif
rem declare common variables
mouseclick=mouseclick()
altkey =keystate(56)
rem ship movement calculations(keyboard)
if rightkey()=1 then position mouse mousex()+shipspeed,mousey()
if leftkey()=1 then position mouse mousex()-shipspeed,mousey()
if upkey()=1 then position mouse mousex(),mousey()-shipspeed
if downkey()=1 then position mouse mousex(),mousey()+shipspeed
rem ship movement calculations(mouse)
if mousex()>320 then position mouse 320,mousey()
spriteposx(ship)=mousex()
spriteposy(ship)=mousey()
rem draw star background
for r=firststar to laststar
starposx(r)=starposx(r)-.25
if starposx(r)<=0 then starposx(r)=640 : starposy(r)=rnd(480)
ink starcolor(r),0
dot starposx(r),starposy(r)
next r
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 draw ship
sprite 1,mousex(),mousey(),health
rem draw shield
if shields=1 then show sprite shield else hide sprite shield
sprite shield,spriteposx(ship)+20,mousey()-11,21
rem check for bossfight start
if spriteposx(boss)<2000 and spritehealth(boss)>0 and bossfight=0
bossfight=1
show sprite boss+4
show sprite boss
textx=640
announcement$="Boss Approaching"
endif
rem check time
rem check time for boss kill score screen
if timer()-bosskilltime>2000 and spritehealth(boss)<=0
accomplishment(5)=ammo
accomplishment(7)=lives
for s=1 to 2000
if sprite exist(s)=1 then hide sprite s
next s
cls
sync
scorescreen()
goto main
endif
rem if dead, kill player
if health<=0
if deathtime=0
deathtime=timer()
shields=0
dec lives
rem if have lives left, respawn player, otherwise game over
if lives>0
spawning=1
else
gameovertime=timer()
endif
rem big particle when player dies
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
rem print message if out of lives
if lives<=0
set text size 70
ink rgb(255,0,55),0
center text 320,240,"Your Head A Splode"
endif
endif
rem respawn player after two seconds
if spawning=1
circle mousex()+15,mousey()+20,20
if timer()-deathtime>2000 and deathtime<>0
health=3
shields=1
particle(mousex()+15,mousey()+20,30,rgb(255,255,0))
spawning=0
deathtime=0
endif
endif
rem check time for player death score screen
if timer()-gameovertime>2000 and gameovertime<>0
for s=1 to 2000
if sprite exist(s)=1 then hide sprite s
next s
cls
sync
scorescreen()
goto main
endif
rem manage bullets
justshot=justshot-1
if justshot<=0 then justshot=0
for x=firstbullet to lastbullet
if (mouseclick=1 or mouseclick=3 or spacekey()=1)=1 and justshot=0 and energy#>energycost# and health>0
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
rem check for collision with boss and shield
if sprite collision(boss,x)=1 and spritehealth(boss)>0
spritehealth(boss)=spritehealth(boss)-(buldmg^bullvl)
resetbullet(x)
endif
if sprite collision(boss+4,x)=1 and spritehealth(boss+4)>0
spritehealth(boss+4)=spritehealth(boss+4)-(buldmg^bullvl)
resetbullet(x)
endif
endif
rem check for enemy ship/shield collision
for s=firstenemy to lastenemy step 6
rem damage enemy shield
if sprite exist(s+1)=1
if sprite collision(s+1,x)=1 and spritehealth(s+1)>0
resetbullet(x)
spritehealth(s+1)=spritehealth(s+1)-(buldmg^bullvl)
endif
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 (mouseclick=2 or mouseclick=3 or keystate(56)=1) and llc<>2 and llc<>3 and llalt=0 and justshotmsl=0 and ammo>0 and health>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
rem check for collision with bossparts/shield
if sprite collision(boss,y)=1 and spritehealth(boss)>0
spritehealth(boss)=spritehealth(boss)-(msldmg*msllvl)
resetmissle(y)
endif
if sprite collision(boss+4,y)=1 and spritehealth(boss+4)>0
spritehealth(boss+4)=spritehealth(boss+4)-(msldmg*msllvl)
resetmissle(y)
endif
endif
rem check for enemy collision
for s=firstenemy to lastenemy step 6
rem check for collision with enemy shield
if sprite exist(s+1)=1
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 lvl 2,3 missles pierce shields
if msllvl=1 then resetmissle(y)
endif
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 powerups
for p=firstpowerup to lastpowerup
rem if powerup unready(active) then move it
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
rem draw powerups
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 and bosskilltime=0
if spriteimage(e)=22 then spriteposy(e)=spriteposx(e)*.75
if spriteimage(e)=23 then spriteposy(e)=(-1*hcos(spriteposx(e)))/30+mapdata(e+2)
if spriteimage(e)=24 then spriteposy(e)=sin(timer()/30+3*e)^9*240+mapdata(e+2)
if spriteimage(e)=33 then spriteposy(e)=10
if spriteimage(e)=34 then spriteposy(e)=450
if spriteimage(e)=35 then spriteposy(e)=mapdata(e+2)
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 and health>0
health=health-1
killenemy(e)
endif
rem check for collision with shield
if sprite collision(shield,e)=1 and shields=1
shields=0
killenemy(e)
endif
rem freeze enemy if dead/offscreen
if spriteposx(e)<-30 then spriteposx(e)=-100
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 photon ship ready to fire bullet, release and make unready
if spriteimage(e)=33
if weaponready(e)=39*b
weaponready(e+b)=0
endif
endif
rem if arrow ship ready to fire bullet, release and make unready
if spriteimage(e)=34
if weaponready(e)=39*b
weaponready(e+b)=0
endif
endif
rem if hive ship ready to fire bullet, release and make unready
if spriteimage(e)=35
if weaponready(e)=39*b
weaponready(e+b)=0
endif
endif
rem if unready(ie, already shot) move it, etc.
if weaponready(e+b)=0
rem for ships
if spriteimage(e)=22 or spriteimage(e)=23 or spriteimage(e)=24
spriteposx(e+b)=spriteposx(e+b)-5
endif
if spriteimage(e)=33 then spriteposy(e+b)=spriteposy(e+b)+5 : spriteposx(e+b)=spriteposx(e+b)-1
if spriteimage(e)=34 then spriteposy(e+b)=spriteposy(e+b)-5 : spriteposx(e+b)=spriteposx(e+b)-1
if spriteimage(e)=35
spriteposy(e+b)=spriteposy(e+b)+5*sin(90*b) : spriteposx(e+b)=spriteposx(e+b)-1
spriteposx(e+b)=spriteposx(e+b)+5*cos(90*b) : spriteposx(e+b)=spriteposx(e+b)-1
endif
show sprite e+b
rem if bullet offscreen, make ready again
if spriteposx(e+b)<0 or spriteposy(e+b)>480 or spriteposy(e+b)<0 or spriteposx(e+b)>640
weaponready(e+b)=1
hide sprite e+b
endif
rem check for collision with player
if sprite collision(ship,e+b)=1
dec health
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
rem missle ship bullets pierce debris
if spriteimage(e+b)<>26
weaponready(e+b)=1
hide sprite e+b
endif
rem reposition debris sprite
killdebris(w,0)
endif
next w
rem check for collision with player missle
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
if sprite exist(e+1)=1
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
endif
rem draw enemy sprites
sprite e,spriteposx(e),spriteposy(e),spriteimage(e)
next e
rem manage boss
if bossfight=0 then spriteposx(boss)=spriteposx(boss)-1
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,firstbossbullet,lastbossbullet)
bosskilltime=timer()
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)+55
spriteposy(u)=spriteposy(boss)+35+75*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 bullet 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()
llalt=keystate(56)
rem refresh screen
sync
loop
rem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rem functions***************************************************************
rem ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rem releasepowerup function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem drops desired powerup at target location
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<26 then image=13
rem drop weapon upgrade
if (c-27)=0 then image=14
rem drop missle upgrade
if (c-26)=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 creates a new particle at target location with desired size and color
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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
rem continues the motion of all particles when called
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)
rem reward player w/ points and appropriate powerup
rem ships drop a powerup defined by their type
rem turrets drop random powerups
if spriteimage(e)=22 or spriteimage(e)=23 or spriteimage(e)=24
releasepowerup(spriteimage(e)+79,spriteposx(e),spriteposy(e))
endif
if spriteimage(e)=33 or spriteimage(e)=34 or spriteimage(e)=35
releasepowerup(rnd(25),spriteposx(e),spriteposy(e))
endif
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))
rem reset health, position, etc
if spriteimage(e)=22
spritehealth(e)=4
spritehealth(e+1)=4
endif
if spriteimage(e)=23
spritehealth(e)=5
spritehealth(e+1)=5
endif
if spriteimage(e)=24
spritehealth(e)=4
spritehealth(e+1)=5
endif
if spriteimage(e)=33 then spritehealth(e)=20
if spriteimage(e)=34 then spritehealth(e)=20
if spriteimage(e)=35 then spritehealth(e)=15
show sprite e
if sprite exist(e+1)=1 then show sprite e+1
spriteposx(e)=-100
if sprite exist(e+1)=1 then 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
rem parameters are boss id#,bullet id#,last bullet id#
function killboss(boss,first,last)
for x=first to last
particle(spriteposx(x),spriteposy(x),10,rgb(255,20,20))
hide sprite x
next x
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
rem point reward for boss kill
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
rem if killed by player shot, inc score
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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem constantly displays player accomplishments, score, and rating
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,25,"Ship Bonus x " + str$(accomplishment(7))+ " = " + str$(300*accomplishment(7))
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
levelscore = 1*accomplishment(1) + 100*accomplishment(2) + 1000*accomplishment(3) + 150*accomplishment(4) + 100*accomplishment(5) + 5*accomplishment(6)
center text 320,200,"LEVEL SCORE: " + str$(levelscore)
levelscore(currentlevel(0))=levelscore
rem score for all levels together
ink rgb(255,230,200),0
totalscore=levelscore(1)+levelscore(2)+levelscore(3)+levelscore(4)+levelscore(5)+levelscore(6)+levelscore(7)+levelscore(8)+levelscore(9)+levelscore(10)
center text 320,300,"TOTAL SCORE: " + str$(totalscore)
rem print rating
set text size 50
if levelscore<1000 then rating$="Suxxorz" : ink rgb(255,128,128),0
if levelscore>1000 then rating$="TeH RoXxOrZ" : ink rgb(123,100,20),0
if levelscore>2000 then rating$="PWNAGE" : ink rgb(200,200,200),0
if levelscore>3000 then rating$="U83R L33T" : ink rgb(250,200,20),0
if levelscore>4000 then rating$="WTF, HAX!1!!!?" : ink rgb(180,180,255),0
center text 320,260,"Your Rating:" + rating$
rem advance/try again, depending if died or not
if accomplishment(7)=0
ink rgb(133,133,255),0
center text 320,380,"Press Enter To Try Again"
if returnkey()=1
for n=1 to 10
levelscore(n)=0
next n
currentlevel(0)=1
restart(0)=1
exitfunction
endif
else
ink rgb(133,0,255),0
center text 320,380,"Press Enter To Continue"
if returnkey()=1
currentlevel(0)=currentlevel(0)+1
restart(0)=1
exitfunction
endif
endif
rem press esc to quit
ink rgb(255,20,20),0
center text 320,430,"Press Esc to Quit"
if escapekey()=1 then end
updateparticles()
sync
loop
endfunction
here is the mapmaker code (save as mapmaker.dba for the main program to work)
rem save array of sprite number, sprite image, xpos, ypos <-----
rem for turrets and enemy ships
`*********************************************************************
rem map maker for symbol shooter!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
`@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
dim mapdata(2000)
dim campos(0)
mapmaker()
end
function mapmaker()
sync on
sync rate 90
rem load images~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set text size 10
ink rgb(255,25,75),0
text 0,0,"X"
get image 1,0,0,10,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 7,3,"-"
text 9,27,"-"
text 7,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 7,3,"-"
text 9,27,"-"
text 7,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 7,3,"-"
text 9,27,"-"
text 7,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 7,3,"-"
text 9,27,"-"
text 7,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 make enemy turrets
rem make photon turret sprite
ink rgb(0,255,128),0
text 0,0,"W"
text 12,0,"-"
text 14,0,"W"
get image 33,0,0,32,15
cls
rem make arrow turret sprite
ink rgb(78,139,34),0
text 0,0,"(Y)"
get image 34,0,0,30,16
cls
rem make hive turret sprite
ink rgb(255,255,30),0
text 0,0,"3"
text 6,0,"="
text 8,0,"3"
get image 35,0,0,30,15
cls
rem make photon turret bullet sprite
ink rgb(255,128,128),0
text 3,0,"**"
get image 36,0,0,20,18
cls
rem make arrow turret bullet sprite
ink rgb(128,255,128),0
text 1,0,"^^"
get image 37,0,0,20,16
cls
rem make hive turret bullet sprite
ink rgb(128,128,255),0
text 4,2,"%"
get image 38,4,2,14,16
cls
rem initialize array
rem first element is sprite number
rem mapdata(#) is sprite existance
rem mapdata(#+1) is xpos
rem mapdata(#+2) is ypos
rem mapdata(#+3) is sprite image
dim mapdata(2000)
rem initialize series variables
rem initialize variables
dim campos(0)
campos(0)=0
firstenemy=91
boss=1300
sprite 1,1,1,1
do
cls
rem print camera position
set text size 10
ink rgb(0,128,0),0
for x=0 to 10000 step 500
text x-campos(0),465,str$(x)
next x
ink rgb(126,255,125),0
text 0,465,str$(campos(0))
rem print instructions
ink rgb(255,255,255),0
text 0,50,"Press s to save"
text 0,65,"Press l to load"
text 0,80,"Type cancel to cancel a load or save"
text 0,95,"Hold d and click to delete"
text 0,110,"Press q to quit"
center text 430,10,"5:} 6:> 7:D 8:W-W 9:(Y) 0:3=3 b:Boss"
center text 430,25,"Hold key and click to place object"
rem print findnext
print "Placing Sprite #: " ; findnext()
rem make line where level starts (announcement over)
ink rgb(255,100,0),0
line (2100/4)-campos(0),0,(2100/4)-campos(0),480
rem camera controls
if rightkey()=1 then campos(0)=campos(0)+5
if leftkey()=1 then campos(0)=campos(0)-5
rem place enemies
if scancode()=6 or scancode()=7 or scancode()=8
image=16+scancode()
sprite 1,mousex(),mousey(),image
size sprite 1,20,30
show sprite 1
hide mouse
if mouseclick()=1 and llc=0
placesprite(findnext(),mousex(),mousey(),image)
endif
endif
rem place turrets
if scancode()=9 or scancode()=10 or scancode()=11
image=24+scancode()
sprite 1,mousex(),mousey(),image
hide mouse
show sprite 1
size sprite 1,60,20
if mouseclick()=1 and llc=0
placesprite(findnext(),mousex(),mousey(),image)
endif
endif
rem place boss
if inkey$()="b"
image=31
sprite 1,mousex(),mousey(),image
hide mouse
show sprite 1
size sprite 1,300,300
if mouseclick()=1 and llc=0
placesprite(1300,mousex(),mousey(),31)
endif
endif
rem show mouse if not placing object
if scancode()=0 then hide sprite 1 : show mouse
rem deleting objects
if inkey$()="d"
show sprite 1
size sprite 1,20,30
hide mouse
sprite 1,mousex(),mousey(),1
if mouseclick()=1 and llc=0
for d=91 to findlast()
rem if red x collides while clicking, delete sprite and reset data
if mapdata(d)=1
if distance(mousex(),mousey(),mapdata(d+1)-campos(0),mapdata(d+2))<30
delete sprite d
mapdata(d)=0
mapdata(d+1)=0
mapdata(d+2)=0
mapdata(d+3)=0
endif
endif
next d
endif
endif
rem load a previously saved map
if inkey$()="l"
input "Load File> ",mapname$
if mapname$<>"cancel"
rem delete current map
campos(0)=0
mapdata(1)=0
for y=91 to findlast() step 6
if sprite exist(y)=1 then delete sprite y
mapdata(y)=0
mapdata(y+1)=0
mapdata(y+2)=0
mapdata(y+3)=0
next y
if sprite exist(1300)=1 then delete sprite 1300
mapdata(1300)=0
mapdata(1300+1)=0
mapdata(1300+2)=0
mapdata(1300+3)=0
load array mapname$,mapdata(2000)
print "Map named " + mapname$ + " has been loaded"
rem place loaded sprited in proper location
for y=91 to mapdata(1) step 6
if mapdata(y)=1
placesprite(y,mapdata(y+1),mapdata(y+2),mapdata(y+3))
endif
next y
wait 200
rem place boss
if mapdata(1300)=1 then placesprite(1300,mapdata(1300+1),mapdata(1300+2),31)
rem if type cancel, cancel load
else
print "Map load canceled"
wait 200
endif
endif
rem save map
if inkey$()="s"
rem save last enemy variable in mapdata(1)
mapdata(1)=findlast()
rem ask for file name
input "Save As>",mapname$
rem save array in as file name
if mapname$<>"cancel"
save array mapname$,mapdata(2000)
print "Map named " + mapname$ + " has been saved"
wait 200
rem if type "cancel" cancel save
else
print "Map save canceled"
wait 200
endif
endif
rem quit
if inkey$()="q" then exitfunction
rem draw sprites
set text size 10
for x=91 to findlast() step 6
if mapdata(x)=1
sprite x,mapdata(x+1)-campos(0),mapdata(x+2),mapdata(x+3)
text mapdata(x+1)-campos(0),mapdata(x+2),str$(x)
endif
next x
if mapdata(1300)=1
sprite 1300,mapdata(1300+1)-campos(0),mapdata(1300+2),31
endif
rem store last loop variables
llc=mouseclick()
sync
loop
endfunction
rem functions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem place sprite function!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem places the desired sprite number at target location, specified image
rem n=sprite number, x=xpos, y=ypos, i=image
function placesprite(n,x,y,i)
rem if sprite already exists at that #, delete
if sprite exist(n)=1 then delete sprite n
sprite n,x,y,i
rem size sprites depending on image
if i=22 or i=23 or i=24
size sprite n,20,30
mirror sprite n
endif
if i=33 or i=34 or i=35
size sprite n,60,20
if i=34 then flip sprite n
endif
if i=31
size sprite n,300,300
endif
rem save values to array
mapdata(n)=1
mapdata(n+1)=x+campos(0)
mapdata(n+2)=y
mapdata(n+3)=i
endfunction
rem findnext sprite function************************************************
rem finds the next available sprite number and outputs as "n"
function findnext()
n=91
do
if mapdata(n+3)<>0
n=n+6
else
exitfunction n
endif
loop
endfunction n
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 find last function ***************************************************
rem finds the greatest occupied sprite number
rem only checks for 200 enemies, but seriously, i'm never having that many
rem in one level
function findlast()
for n=91 to 1291 step 6
if sprite exist(n)=1 then last=n
next n
endfunction last
attatched is level 1, an array i've saved as a .txt file.
if all these pieces are saved together it should work.
i will post the version that has the main program just #include the mapmaker, with some other features, later.
Truth suffers from too much analysis.
-Ancient Fremen Saying