OK, maybe I try to post as a snippet...
rem ///////////////////////////////
rem ||||||||||AirBlasters||||||||||
rem \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
rem -----Made by SonicFreak12------
rem Start by setting display mode and sync mode, and hide the mouse
set display mode 640,480,32
sync rate 30
sync on
hide mouse
rem Reseed the random generator
randomize rnd(1000)
rem Create enemy variable array
dim edata(3,8,25)
rem Read data into enemy array
for t=1 to 3
for e=1 to 8
for v=1 to 25
if v=1 then edata(t,e,v)=1
if v=2 then edata(t,e,v)=rnd(640)
if v=3 then edata(t,e,v)=rnd(380)
if v=20 then edata(t,e,v)=1
next v
next e
next t
rem Set the initial level number
levelnumber=1
rem Set the initial positions
groundlevel=470
newx=160
newy=groundlevel
rem Set initial final loop number
finalloop=1
rem Get the character number (This is temporary)
character=1
rem Set intial enemy numbers
roller=11
rmode=1
rem Get the level background pictures
gosub levelbggrab
rem Get the platform pictures
gosub levelplatgrab
rem Go and grab the sprite pictures for the characters
gosub charspritegrab
rem activate debug mode (temporary)
debugmode=1
rem Set up the sprite
jumpmode=0
damage=0
health=5
action=1
mode=1
sprite 100,newx,newy,(1000*character)+(100*damage)+action
scale sprite 100,50
offset sprite 100,40,79
rem Firing should be ready now
fireready=1
bulletnumber=2
rfireready=1
rem Main Loop
do
rem If on level 0 use level 1 background
if levelnumber=0 then paste image 11,0,0
rem If the level is from 1 to 7 use normal level backgrounds
if levelnumber>=1 and levelnumber<=7 then paste image levelnumber+10,0,0
rem If level is 8 then use the final loop
if levelnumber=8
inc finalloop
if finalloop>6 then finalloop=1
paste image finalloop+30,0,0
endif
rem If on bonus level use bonus background
if bonuslevel=1 then paste image 37,0,0
rem Go through subroutines
gosub platform
gosub player
gosub roller
if debugmode=1 then gosub debug
rem Synchronize and End Loop
sync
loop
charspritegrab:
rem Load the normal character images
for i=0 to 3
for c=1 to 7
for a=1 to 66
i$=str$(i)
a$=str$(a)
select c
case 1 : n$="roja" : endcase
case 2 : n$="anaranjada" : endcase
case 3 : n$="amarilla" : endcase
case 4 : n$="verda" : endcase
case 5 : n$="azula" : endcase
case 6 : n$="morada" : endcase
case 7 : n$="blanca" : endcase
endselect
if a<=9 : spritefile$="player/"+i$+n$+"000"+a$+".bmp"
else : spritefile$="player/"+i$+n$+"00"+a$+".bmp"
endif
spritefileimage=(c*1000)+(i*100)+a
load image spritefile$,spritefileimage
next a
next c
next i
rem Load shot images
load image "lightpuff.bmp",7
load image "darkpuff.bmp",6
rem Load "pop" image
load image "pop.bmp",5
rem Load "robo" images
for r=1 to 7
select r
case 1 : r$="roja" : endcase
case 2 : r$="anaranjada" : endcase
case 3 : r$="amarilla" : endcase
case 4 : r$="verda" : endcase
case 5 : r$="azula" : endcase
case 6 : r$="morada" : endcase
case 7 : r$="blanca" : endcase
endselect
for ra=1 to 4
ra$=str$(ra)
robofile$="player/robo"+r$+"000"+ra$+".bmp"
robofileimage=900+(r*10)+ra
load image robofile$,robofileimage
next ra
next r
rem Load enemy images
for el=1 to 1
el$=str$(el)
for et=1 to 1
select et
case 1 : et$="roller" : actionmax=31 : endcase
case 2 : et$="flyer" : endcase
case 3 : et$="big" : endcase
endselect
for ed=0 to 3
ed$=str$(ed)
for ea=1 to actionmax
ea$=str$(ea)
if ea<=9 : enemyfile$="enemy/"+el$+et$+ed$+"_000"+ea$+".bmp"
else : enemyfile$="enemy/"+el$+et$+ed$+"_00"+ea$+".bmp"
endif
enemyfileimage=(el*10000)+(et*1000)+(ed*100)+ea
load image enemyfile$,enemyfileimage
next ea
next ed
next et
next el
return
levelbggrab:
rem Get the level backgrounds
for l=1 to 7
l$=str$(l)
bgfile$="level"+l$+"bg.bmp"
bgfileimage=l+10
load image bgfile$,bgfileimage
next l
rem Get bonus level background
load image "bonusbg.bmp",37
rem Get final level anim backgrounds
for f=1 to 6
f$=str$(f)
ffile$="finalbg000"+f$+".bmp"
ffileimage=f+30
load image ffile$,ffileimage
next f
return
levelplatgrab:
for p=1 to 7
p$=str$(p)
pfile$="level"+p$+"plat.bmp"
pfileimage=p+20
load image pfile$,pfileimage
next p
return
platform:
rem IMPORTANT:
rem Make sure if two platforms are over each other,
rem make the higher one(s) higher number(s)
rem Check level number and place platforms accordingly
if levelnumber=1
plat0x=0 : plat0y=350
plat1x=641 : plat1y=481
plat2x=320 : plat2y=350
plat3x=480 : plat3y=350
plat4x=0 : plat4y=220
plat5x=160 : plat5y=220
plat6x=641 : plat6y=481
plat7x=480 : plat7y=220
plat8x=160 : plat8y=85
plat9x=320 : plat9y=85
for platform=0 to 9
select platform
case 0 : sprite 200,plat0x,plat0y,21 : endcase
case 1 : sprite 201,plat1x,plat1y,21 : endcase
case 2 : sprite 202,plat2x,plat2y,21 : endcase
case 3 : sprite 203,plat3x,plat3y,21 : endcase
case 4 : sprite 204,plat4x,plat4y,21 : endcase
case 5 : sprite 205,plat5x,plat5y,21 : endcase
case 6 : sprite 206,plat6x,plat6y,21 : endcase
case 7 : sprite 207,plat7x,plat7y,21 : endcase
case 8 : sprite 208,plat8x,plat8y,21 : endcase
case 9 : sprite 209,plat9x,plat9y,21 : endcase
endselect
next platform
endif
if levelnumber=2
plat0x=160 : plat0y=350
plat1x=320 : plat1y=350
plat2x=0 : plat2y=220
plat3x=480 : plat3y=220
plat4x=160 : plat4y=85
plat5x=320 : plat5y=85
plat6x=641 : plat6y=481
plat7x=641 : plat7y=481
plat8x=641 : plat8y=481
plat9x=641 : plat9y=481
for platform=0 to 9
select platform
case 0 : sprite 200,plat0x,plat0y,22 : endcase
case 1 : sprite 201,plat1x,plat1y,22 : endcase
case 2 : sprite 202,plat2x,plat2y,22 : endcase
case 3 : sprite 203,plat3x,plat3y,22 : endcase
case 4 : sprite 204,plat4x,plat4y,22 : endcase
case 5 : sprite 205,plat5x,plat5y,22 : endcase
case 6 : sprite 206,plat6x,plat6y,22 : endcase
case 7 : sprite 207,plat7x,plat7y,22 : endcase
case 8 : sprite 208,plat8x,plat8y,22 : endcase
case 9 : sprite 209,plat9x,plat9y,22 : endcase
endselect
next platform
endif
if levelnumber=3
plat0x=160 : plat0y=350
plat1x=320 : plat1y=350
plat2x=480 : plat2y=350
plat3x=0 : plat3y=220
plat4x=160 : plat4y=220
plat5x=320 : plat5y=220
plat6x=160 : plat6y=85
plat7x=320 : plat7y=85
plat8x=480 : plat8y=85
plat9x=641 : plat9y=481
for platform=0 to 9
select platform
case 0 : sprite 200,plat0x,plat0y,23 : endcase
case 1 : sprite 201,plat1x,plat1y,23 : endcase
case 2 : sprite 202,plat2x,plat2y,23 : endcase
case 3 : sprite 203,plat3x,plat3y,23 : endcase
case 4 : sprite 204,plat4x,plat4y,23 : endcase
case 5 : sprite 205,plat5x,plat5y,23 : endcase
case 6 : sprite 206,plat6x,plat6y,23 : endcase
case 7 : sprite 207,plat7x,plat7y,23 : endcase
case 8 : sprite 208,plat8x,plat8y,23 : endcase
case 9 : sprite 209,plat9x,plat9y,23 : endcase
endselect
next platform
endif
if levelnumber=4
plat0x=160 : plat0y=350
plat1x=320 : plat1y=350
plat2x=0 : plat2y=220
plat3x=480 : plat3y=220
plat4x=0 : plat4y=85
plat5x=480 : plat5y=85
plat6x=641 : plat6y=481
plat7x=641 : plat7y=481
plat8x=641 : plat8y=481
plat9x=641 : plat9y=481
for platform=0 to 9
select platform
case 0 : sprite 200,plat0x,plat0y,24 : endcase
case 1 : sprite 201,plat1x,plat1y,24 : endcase
case 2 : sprite 202,plat2x,plat2y,24 : endcase
case 3 : sprite 203,plat3x,plat3y,24 : endcase
case 4 : sprite 204,plat4x,plat4y,24 : endcase
case 5 : sprite 205,plat5x,plat5y,24 : endcase
case 6 : sprite 206,plat6x,plat6y,24 : endcase
case 7 : sprite 207,plat7x,plat7y,24 : endcase
case 8 : sprite 208,plat8x,plat8y,24 : endcase
case 9 : sprite 209,plat9x,plat9y,24 : endcase
endselect
next platform
endif
if levelnumber=5
plat0x=160 : plat0y=350
plat1x=320 : plat1y=350
plat2x=480 : plat2y=350
plat3x=320 : plat3y=220
plat4x=480 : plat4y=220
plat5x=0 : plat5y=85
plat6x=160 : plat6y=85
plat7x=320 : plat7y=85
plat8x=641 : plat8y=481
plat9x=641 : plat9y=481
for platform=0 to 9
select platform
case 0 : sprite 200,plat0x,plat0y,25 : endcase
case 1 : sprite 201,plat1x,plat1y,25 : endcase
case 2 : sprite 202,plat2x,plat2y,25 : endcase
case 3 : sprite 203,plat3x,plat3y,25 : endcase
case 4 : sprite 204,plat4x,plat4y,25 : endcase
case 5 : sprite 205,plat5x,plat5y,25 : endcase
case 6 : sprite 206,plat6x,plat6y,25 : endcase
case 7 : sprite 207,plat7x,plat7y,25 : endcase
case 8 : sprite 208,plat8x,plat8y,25 : endcase
case 9 : sprite 209,plat9x,plat9y,25 : endcase
endselect
next platform
endif
if levelnumber=6
plat0x=0 : plat0y=350
plat1x=480 : plat1y=350
plat2x=140 : plat2y=300
plat3x=340 : plat3y=300
plat4x=240 : plat4y=240
plat5x=140 : plat5y=180
plat6x=340 : plat6y=180
plat7x=0 : plat7y=90
plat8x=480 : plat8y=90
plat9x=641 : plat9y=481
for platform=0 to 9
select platform
case 0 : sprite 200,plat0x,plat0y,26 : endcase
case 1 : sprite 201,plat1x,plat1y,26 : endcase
case 2 : sprite 202,plat2x,plat2y,26 : endcase
case 3 : sprite 203,plat3x,plat3y,26 : endcase
case 4 : sprite 204,plat4x,plat4y,26 : endcase
case 5 : sprite 205,plat5x,plat5y,26 : endcase
case 6 : sprite 206,plat6x,plat6y,26 : endcase
case 7 : sprite 207,plat7x,plat7y,26 : endcase
case 8 : sprite 208,plat8x,plat8y,26 : endcase
case 9 : sprite 209,plat9x,plat9y,26 : endcase
endselect
next platform
endif
if levelnumber=7
plat0x=0 : plat0y=350
plat1x=480 : plat1y=350
plat2x=160 : plat2y=240
plat3x=320 : plat3y=240
plat4x=0 : plat4y=220
plat5x=480 : plat5y=220
plat6x=160 : plat6y=105
plat7x=320 : plat7y=105
plat8x=0 : plat8y=85
plat9x=480 : plat9y=85
for platform=0 to 9
select platform
case 0 : sprite 200,plat0x,plat0y,27 : endcase
case 1 : sprite 201,plat1x,plat1y,27 : endcase
case 2 : sprite 202,plat2x,plat2y,27 : endcase
case 3 : sprite 203,plat3x,plat3y,27 : endcase
case 4 : sprite 204,plat4x,plat4y,27 : endcase
case 5 : sprite 205,plat5x,plat5y,27 : endcase
case 6 : sprite 206,plat6x,plat6y,27 : endcase
case 7 : sprite 207,plat7x,plat7y,27 : endcase
case 8 : sprite 208,plat8x,plat8y,27 : endcase
case 9 : sprite 209,plat9x,plat9y,27 : endcase
endselect
next platform
endif
rem No platforms on levels 0,8, and bonus
if levelnumber=0 or levelnumber=8 or bonuslevel=1
plat0x=641 : plat0y=481
plat1x=641 : plat1y=481
plat2x=641 : plat2y=481
plat3x=641 : plat3y=481
plat4x=641 : plat4y=481
plat5x=641 : plat5y=481
plat6x=641 : plat6y=481
plat7x=641 : plat7y=481
plat8x=641 : plat8y=481
plat9x=641 : plat9y=481
for platform=0 to 9
select platform
case 0 : sprite 200,plat0x,plat0y,27 : endcase
case 1 : sprite 201,plat1x,plat1y,27 : endcase
case 2 : sprite 202,plat2x,plat2y,27 : endcase
case 3 : sprite 203,plat3x,plat3y,27 : endcase
case 4 : sprite 204,plat4x,plat4y,27 : endcase
case 5 : sprite 205,plat5x,plat5y,27 : endcase
case 6 : sprite 206,plat6x,plat6y,27 : endcase
case 7 : sprite 207,plat7x,plat7y,27 : endcase
case 8 : sprite 208,plat8x,plat8y,27 : endcase
case 9 : sprite 209,plat9x,plat9y,27 : endcase
endselect
next platform
endif
rem See if player over each platform: If so, set that as ground height
if sprite x(100)>=plat0x and sprite x(100)<=plat0x+160 and sprite y(100)<=plat0y
groundlevel=plat0y
notover0=0
else
notover0=1
endif
if sprite x(100)>=plat1x and sprite x(100)<=plat1x+160 and sprite y(100)<=plat1y
groundlevel=plat1y
notover1=0
else
notover1=1
endif
if sprite x(100)>=plat2x and sprite x(100)<=plat2x+160 and sprite y(100)<=plat2y
groundlevel=plat2y
notover2=0
else
notover2=1
endif
if sprite x(100)>=plat3x and sprite x(100)<=plat3x+160 and sprite y(100)<=plat3y
groundlevel=plat3y
notover3=0
else
notover3=1
endif
if sprite x(100)>=plat4x and sprite x(100)<=plat4x+160 and sprite y(100)<=plat4y
groundlevel=plat4y
notover4=0
else
notover4=1
endif
if sprite x(100)>=plat5x and sprite x(100)<=plat5x+160 and sprite y(100)<=plat5y
groundlevel=plat5y
notover5=0
else
notover5=1
endif
if sprite x(100)>=plat6x and sprite x(100)<=plat6x+160 and sprite y(100)<=plat6y
groundlevel=plat6y
notover6=0
else
notover6=1
endif
if sprite x(100)>=plat7x and sprite x(100)<=plat7x+160 and sprite y(100)<=plat7y
groundlevel=plat7y
notover7=0
else
notover7=1
endif
if sprite x(100)>=plat8x and sprite x(100)<=plat8x+160 and sprite y(100)<=plat8y
groundlevel=plat8y
notover8=0
else
notover8=1
endif
if sprite x(100)>=plat9x and sprite x(100)<=plat9x+160 and sprite y(100)<=plat9y
groundlevel=plat9y
notover9=0
else
notover9=1
endif
rem If not over a platform, restore normal groundlevel
if notover0=1 and notover1=1 and notover2=1 and notover3=1 and notover4=1 and notover5=1 and notover6=1 and notover7=1 and notover8=1 and notover9=1 then groundlevel=470
rem Fall if not on the platform or ground and not jumping
if newy<groundlevel and jumpmode=0
jumpmode=1
jumpstep=0
endif
return
player:
rem Do all this stuff if in mode one
if mode=1
rem Update the character for robo and non-robo modes
if levelnumber=8
sprite 100,newx,newy,900+(10*character)+action
else
sprite 100,newx,newy,(1000*character)+(100*damage)+action
endif
oldx=newx
oldy=newy
rem Do the following only if on level 8
if levelnumber=8
rem Make sure there's no damage, robo mode uses a health meter
damage=0
rem In robo mode, always face right.
if sprite mirrored(100)=1 then mirror sprite 100
rem If D held, go forward a bit slower than normal
if keystate(32)=1
newx=newx+7
action=1
endif
rem If A held, go backward a bit faster than normal
if keystate(30)=1
newx=newx-13
action=3
endif
rem If neither A or D held use "backward" action
if keystate(30)=0 and keystate(32)=0 then action=3
rem if W held, go up at normal robo speed
if keystate(17)=1 then newy=newy-10
rem if S held go down at normal robo speed
if keystate(31)=1 then newy=newy+10
rem If firing change action appropriately.
if keystate(57)=1
if action=1 then action=2
if action=3 then action=4
endif
rem Only do the following if NOT on level 8
else
rem If D key is held, face and move right. Also fire anim if space held.
if keystate(32)=1
if sprite mirrored(100)=1 then mirror sprite 100
newx=newx+(5+damage)
if sprite y(100)=groundlevel
if keystate(57)=0
if action>=3 and action<=31
action=action+2
if action>31 then action=3
else
action=3
endif
endif
if keystate(57)=1
if action>=33 and action<=61
action=action+2
if action>61 then action=33
else
action=33
endif
endif
endif
endif
rem If A key is held, face and move left. Also fire anim if space held.
if keystate(30)=1
if sprite mirrored(100)=0 then mirror sprite 100
newx=newx-(5+damage)
if sprite y(100)=groundlevel
if keystate(57)=0
if action>=3 and action<=31
action=action+2
if action>31 then action=3
else
action=3
endif
endif
if keystate(57)=1
if action>=33 and action<=61
action=action+2
if action>61 then action=33
else
action=33
endif
endif
endif
endif
rem Activate the Jump Sequence if the sprite on the ground and W pressed.
rem Also increase jump power if more damaged to overcome floatiness
if sprite y(100)=groundlevel and keystate(17)=1 then jumpmode=1
if sprite y(100)=groundlevel and keystate(17)=1 then jumpstep=16+((16*damage)/2)
rem Jump sequence, and fire anim if space, also determine sprite ascent/descent
rem Also make more "floaty" if more damaged
if jumpmode=1
newy=newy-jumpstep/(damage+1)
dec jumpstep
if jumpstep>=0
if keystate(57)=0 then action=63
if keystate(57)=1 then action=64
endif
if jumpstep<0
if keystate(57)=0 then action=65
if keystate(57)=1 then action=66
endif
endif
if newy>=groundlevel then jumpmode=0
if jumpmode=0 then newy=groundlevel
rem If W,A, and D are not held, still anim. Still fire if space held.
if keystate(32)=0 and keystate(30)=0 and keystate(17)=0 and jumpmode=0
action=1
if keystate(57)=1 then action=2
endif
rem if S key held, drop
if keystate(31)=1 then newy=newy+1
rem End of non-robo controls.
endif
rem Don't let the character go outside the screen
rem But only restrict top on final level
if newx<20 or newx>620 then newx=oldx
if newy>470 then newy=oldy
if newy<90 and levelnumber=8 then newy=oldy
rem Determine original bullet positions
if sprite mirrored(100)=0 then origbulletx=sprite x(100)+33
if sprite mirrored(100)=1 then origbulletx=sprite x(100)-33
origbullety=sprite y(100)-52
rem Shoot bullets if space is held
if keystate(57)=1
if fireready=1
sprite bulletnumber,origbulletx,origbullety,7
scale sprite bulletnumber,50
offset sprite bulletnumber,20,20
if sprite mirrored(100)=1 and sprite mirrored(bulletnumber)=0 then mirror sprite bulletnumber
if sprite mirrored(100)=0 and sprite mirrored(bulletnumber)=1 then mirror sprite bulletnumber
select bulletnumber
case 2
bull2x=origbulletx
bull2y=origbullety
show sprite 2
endcase
case 3
bull3x=origbulletx
bull3y=origbullety
show sprite 3
endcase
case 4
bull4x=origbulletx
bull4y=origbullety
show sprite 4
endcase
case 5
bull5x=origbulletx
bull5y=origbullety
show sprite 5
endcase
case 6
bull6x=origbulletx
bull6y=origbullety
show sprite 6
endcase
case 7
bull7x=origbulletx
bull7y=origbullety
show sprite 7
endcase
case 8
bull8x=origbulletx
bull8y=origbullety
show sprite 8
endcase
endselect
bulletnumber=bulletnumber+1
if bulletnumber>8 then bulletnumber=2
fireready=0
firetimer=timer()
endif
endif
rem end of "Mode 1" section
endif
rem Regulate the fire rate
if fireready=0
checkready=timer()
if levelnumber=8
if checkready-firetimer>=375 then fireready=1
else
if checkready-firetimer>=500 then fireready=1
endif
endif
rem Move bullet sprites
for b=2 to 8
if sprite exist(b)=1
select b
case 2
if sprite mirrored(2)=0 then bull2x=bull2x+10
if sprite mirrored(2)=1 then bull2x=bull2x-10
sprite b,bull2x,bull2y,7
endcase
case 3
if sprite mirrored(3)=0 then bull3x=bull3x+10
if sprite mirrored(3)=1 then bull3x=bull3x-10
sprite b,bull3x,bull3y,7
endcase
case 4
if sprite mirrored(4)=0 then bull4x=bull4x+10
if sprite mirrored(4)=1 then bull4x=bull4x-10
sprite b,bull4x,bull4y,7
endcase
case 5
if sprite mirrored(5)=0 then bull5x=bull5x+10
if sprite mirrored(5)=1 then bull5x=bull5x-10
sprite b,bull5x,bull5y,7
endcase
case 6
if sprite mirrored(6)=0 then bull6x=bull6x+10
if sprite mirrored(6)=1 then bull6x=bull6x-10
sprite b,bull6x,bull6y,7
endcase
case 7
if sprite mirrored(7)=0 then bull7x=bull7x+10
if sprite mirrored(7)=1 then bull7x=bull7x-10
sprite b,bull7x,bull7y,7
endcase
case 8
if sprite mirrored(8)=0 then bull8x=bull8x+10
if sprite mirrored(8)=1 then bull8x=bull8x-10
sprite b,bull8x,bull8y,7
endcase
endselect
endif
next b
rem Hide and reset bullets if they go off the screen
for bd=2 to 8
if sprite exist(bd)=1
if sprite x(bd)>640 or sprite x(bd)<0 or sprite
hide sprite bd
sprite bd,0,700,7
endif
endif
next bd
rem Pop if on mode 4
if mode=4
if sprite mirrored(100)=1 then mirror sprite 100
sprite 100,newx,newy,5
if timer()-deathtime>500
mode=5
respawntime=timer()
endif
endif
rem Wait to respawn on mode 5
if mode=5
hide sprite 100
if timer()-respawntime>500
mode=1
dec lives
groundlevel=470
newx=160
newy=groundlevel
damage=0
show sprite 100
endif
endif
rem Return to the main loop
return
debug:
rem Manual damage adjuster
if keystate(22)=1 and 22keyheld=0
dec damage
if damage<0 then damage=0
22keyheld=1
endif
if keystate(22)=0 and 22keyheld=1 then 22keyheld=0
if keystate(23)=1 and 23keyheld=0
inc damage
if damage>3 then damage=3
23keyheld=1
endif
if keystate(23)=0 and 23keyheld=1 then 23keyheld=0
rem Manual character changer
if keystate(36)=1 and 36keyheld=0
dec character
if character<1 then character=7
36keyheld=1
endif
if keystate(36)=0 and 36keyheld=1 then 36keyheld=0
if keystate(37)=1 and 37keyheld=0
inc character
if character>7 then character=1
37keyheld=1
endif
if keystate(37)=0 and 37keyheld=1 then 37keyheld=0
rem Manual level changer
if keystate(50)=1 and 50keyheld=0
dec levelnumber
if levelnumber<0 then levelnumber=8
50keyheld=1
endif
if keystate(50)=0 and 50keyheld=1 then 50keyheld=0
if keystate(51)=1 and 51keyheld=0
inc levelnumber
if levelnumber>8 then levelnumber=0
51keyheld=1
endif
if keystate(51)=0 and 51keyheld=1 then 51keyheld=0
return
roller:
rem Set number of enemies
for type=1 to 1
if type=1 then enemymax=8
if type=2 then enemymax=5
if type=3 then enemymax=3
for enemy=1 to enemymax
rem Make sure sprites are separate
if type=1 then roller=enemy+10
if type=2 then roller=enemy+30
if type=3 then roller=enemy+50
rem Copy enemy data for manipulation process
rmode=edata(type,enemy,1)
rx=edata(type,enemy,2)
ry=edata(type,enemy,3)
rdamage=edata(type,enemy,4)
raction=edata(type,enemy,5)
rgroundlevel=edata(type,enemy,6)
rjumpmode=edata(type,enemy,7)
rjumpstep=edata(type,enemy,8)
rflyheight=edata(type,enemy,9)
rnotover0=edata(type,enemy,10)
rnotover1=edata(type,enemy,11)
rnotover2=edata(type,enemy,12)
rnotover3=edata(type,enemy,13)
rnotover4=edata(type,enemy,14)
rnotover5=edata(type,enemy,15)
rnotover6=edata(type,enemy,16)
rnotover7=edata(type,enemy,17)
rnotover8=edata(type,enemy,18)
rnotover9=edata(type,enemy,19)
rfireready=edata(type,enemy,20)
rorigbullx=edata(type,enemy,21)
rorigbully=edata(type,enemy,22)
rbullx=edata(type,enemy,23)
rbully=edata(type,enemy,24)
rdeathtime=edata(type,enemy,25)
rem Update the roller enemy sprite if not dead
if rmode<=3
sprite roller,rx,ry,10000+(type*1000)+(rdamage*100)+raction
if type=1 or type=3
offset sprite roller,40,80
scale sprite roller,50
else
offset sprite roller,80,160
scale sprite roller,100
endif
show sprite roller
endif
rem Old damage should equal damage
rolddamage=rdamage
olddamage=damage
rem If just killed, show "POP!"
if rmode=4 and rdamage>3
if sprite mirrored(roller)=1 then mirror sprite roller
sprite roller,rx,ry,5
if timer()-rdeathtime>500 then rmode=5
endif
rem Hide dead enemies
if rmode=5 and rdamage>3
hide sprite roller
sprite roller,0,1100,5
endif
rem Unused enemies should be dead
if enemy>enemymax-(7-levelnumber)
rmode=5
rdamage=4
endif
rem Move the sprite right if not mirrored and in run mode
if sprite mirrored(roller)=0 and rmode=1
rx=rx+(2+rdamage)
if sprite y(roller)=rgroundlevel
if raction>=2 and raction<=15
raction=raction+1
if raction>31 then raction=3
else
raction=2
endif
endif
endif
rem Move the sprite left if mirrored and in run mode
if sprite mirrored(roller)=1 and rmode=1
rx=rx-(2+rdamage)
if sprite y(roller)=rgroundlevel
if raction>=2 and raction<=15
raction=raction+1
if raction>31 then raction=3
else
raction=2
endif
endif
endif
rem See if roller over each platform: If so, set that as its ground height
if sprite x(roller)>=plat0x and sprite x(roller)<=plat0x+160 and sprite y(roller)<=plat0y
rgroundlevel=plat0y
rnotover0=0
else
rnotover0=1
endif
if sprite x(roller)>=plat1x and sprite x(roller)<=plat1x+160 and sprite y(roller)<=plat1y
rgroundlevel=plat1y
rnotover1=0
else
rnotover1=1
endif
if sprite x(roller)>=plat2x and sprite x(roller)<=plat2x+160 and sprite y(roller)<=plat2y
rgroundlevel=plat2y
rnotover2=0
else
rnotover2=1
endif
if sprite x(roller)>=plat3x and sprite x(roller)<=plat3x+160 and sprite y(roller)<=plat3y
rgroundlevel=plat3y
rnotover3=0
else
rnotover3=1
endif
if sprite x(roller)>=plat4x and sprite x(roller)<=plat4x+160 and sprite y(roller)<=plat4y
rgroundlevel=plat4y
rnotover4=0
else
rnotover4=1
endif
if sprite x(roller)>=plat5x and sprite x(roller)<=plat5x+160 and sprite y(roller)<=plat5y
rgroundlevel=plat5y
rnotover5=0
else
rnotover5=1
endif
if sprite x(roller)>=plat6x and sprite x(roller)<=plat6x+160 and sprite y(roller)<=plat6y
rgroundlevel=plat6y
rnotover6=0
else
rnotover6=1
endif
if sprite x(roller)>=plat7x and sprite x(roller)<=plat7x+160 and sprite y(roller)<=plat7y
rgroundlevel=plat7y
rnotover7=0
else
rnotover7=1
endif
if sprite x(roller)>=plat8x and sprite x(roller)<=plat8x+160 and sprite y(roller)<=plat8y
rgroundlevel=plat8y
rnotover8=0
else
rnotover8=1
endif
if sprite x(roller)>=plat9x and sprite x(roller)<=plat9x+160 and sprite y(roller)<=plat9y
rgroundlevel=plat9y
rnotover9=0
else
rnotover9=1
endif
rem If not over a platform, restore normal groundlevel
if rnotover0=1 and rnotover1=1 and rnotover2=1 and rnotover3=1 and rnotover4=1 and rnotover5=1 and rnotover6=1 and rnotover7=1 and rnotover8=1 and rnotover9=1 then rgroundlevel=470
rem Fall if running and not on the platform or ground and not jumping
if ry<rgroundlevel and rjumpmode=0 and rmode=1
rjumpmode=1
rjumpstep=0
endif
rem Fall sequence.
if rjumpmode=1
ry=ry-rjumpstep/(rdamage+1)
dec rjumpstep
raction=30
endif
rem End jump if at groundlevel
if ry>rgroundlevel
rjumpmode=0
ry=rgroundlevel
endif
rem Mirror enemy if it bumps into a wall
if rx>620 and sprite mirrored(roller)=0 then mirror sprite roller
if rx<20 and sprite mirrored(roller)=1 then mirror sprite roller
rem Activate flying mode if it hit screen edge
if rmode=1 and rgroundlevel=470
if rx>620 or rx<20
rmode=3
rflyheight=rnd(360)
endif
endif
rem Go up if in flying mode, return to run mode after hit top of screen
if rmode=3
ry=ry-(10+(rdamage*2))
raction=31
if ry<rflyheight then rmode=1
endif
rem If at same level as player and in run mode
rem and ready to fire and not jumping
rem and enemy and player groundlevels equal
rem and enemy facing right way activate shoot mode
if sprite y(roller)=sprite y(100) and rmode=1 and rfireready=1 and rjumpmode=0
if rgroundlevel=groundlevel
xdist=rx-newx
if xdist<0 and sprite mirrored(roller)=1 then mirror sprite roller
if xdist>=0 and sprite mirrored(roller)=0 then mirror sprite roller
if sprite mirrored(roller)=0
rorigbullx=sprite x(roller)-40
else
rorigbullx=sprite x(roller)+40
endif
rorigbully=sprite y(roller)-40
rmode=2
raction=15
rfireready=0
endif
endif
rem Go through fire anim process
if rmode=2
inc raction
if raction=23
rbullx=rorigbullx
rbully=rorigbully
sprite roller+10,rorigbullx,rorigbully,6
scale sprite roller+10,50
offset sprite roller+10,20,20
show sprite roller+10
if sprite mirrored(roller)=1 then mirror sprite roller+10
endif
if raction>29
rmode=1
raction=1
endif
endif
rem Check if roller bullet exists and move it appropriately
if sprite exist(roller+10)=1
if sprite mirrored(roller)=0 and sprite mirrored(roller+10)=1 then mirror sprite (roller+10)
if sprite mirrored(roller)=1 and sprite mirrored(roller+10)=0 then mirror sprite (roller+10)
if sprite mirrored(roller+10)=0 then rbullx=rbullx+10
if sprite mirrored(roller+10)=1 then rbullx=rbullx-10
sprite roller+10,rbullx,rbully,6
endif
rem Hide bullet if it leaves screen
if sprite exist(roller+10)=1
if sprite x(roller+10)>640 or sprite x(roller+10)<0
hide sprite roller+10
sprite roller+10,0,900,6
rfireready=1
endif
endif
rem Hide bullet if hit player and do damage if hit player
if sprite exist(roller+10)=1
if sprite hit(roller+10,0)=100
hide sprite roller+10
sprite roller+10,0,900,6
if damage<olddamage+1 then inc damage
if damage>3
mode=4
deathtime=timer()
endif
rfireready=1
endif
endif
rem Hide player's bullet if it hits this enemy and damage enemy
if rmode<=3
for bh=2 to 8
if sprite exist(bh)=1
if sprite hit(bh,roller)=1
hide sprite bh
sprite bh,0,700,7
if rdamage<rolddamage+1 then inc rdamage
if rdamage>3
rmode=4
rdeathtime=timer()
endif
endif
endif
next bh
endif
rem Put processed data back with enemy data
edata(type,enemy,1)=rmode
edata(type,enemy,2)=rx
edata(type,enemy,3)=ry
edata(type,enemy,4)=rdamage
edata(type,enemy,5)=raction
edata(type,enemy,6)=rgroundlevel
edata(type,enemy,7)=rjumpmode
edata(type,enemy,8)=rjumpstep
edata(type,enemy,9)=rflyheight
edata(type,enemy,10)=rnotover0
edata(type,enemy,11)=rnotover1
edata(type,enemy,12)=rnotover2
edata(type,enemy,13)=rnotover3
edata(type,enemy,14)=rnotover4
edata(type,enemy,15)=rnotover5
edata(type,enemy,16)=rnotover6
edata(type,enemy,17)=rnotover7
edata(type,enemy,18)=rnotover8
edata(type,enemy,19)=rnotover9
edata(type,enemy,20)=rfireready
edata(type,enemy,21)=rorigbullx
edata(type,enemy,22)=rorigbully
edata(type,enemy,23)=rbullx
edata(type,enemy,24)=rbully
edata(type,enemy,25)=rdeathtime
rem Go on to the next enemy
next enemy
rem Once enemies done go to next type
next type
return
rem Here's the sprite tester, in case I need it again.
remstart
do
cls
input "type a number, get a sprite",image$
image=val(image$)
sprite 100,320,240,image
offset sprite 100,40,80
scale sprite 100,50
suspend for key
sync
loop
remend
remstart Extra function. Not necessary... For now.
function rollerbigsmart(number)
if number<30 then number=0
if number>=30 and number<50 then number=1
if number>=50 then number=2
endfunction number
remend