' Sega Genesis BasiEgaXorz Galaxian ' Made by Joseph Norman option title,"DevSter`s GALAXIAN!" data "*GALAXIAN*" ship=addsprite(1,1) ' add the sprite for the ship title: cls reload for a=0 to 7 pallette rgb(a,0,0),0,0 sleep 10 next pallette rgb(0,0,7),0,1 for a=1 to 19 step 2 ink 1 locate 7,a+8 read b print chr$(b) for c=0 to 7 pallette rgb(7-c,0,c),1,1 sleep 10 next ink 0 locate 7,8+a print chr$(b) next for a=1 to 10 scroll right,2 sleep 1 scroll down,2 sleep 1 scroll left,2 sleep 1 scroll up,2 sleep 1 next skiptitle: ink 2 locate 20,0: print "Press a key to start" ink 3 locate 24,0: print "BasiEgaXorz shoot em up by DevSter" on vblank gosub interruptstartgame enable interrupt vblank while 1 for a=7 to 0 step 65535 pallette rgb(0,7-a,a),0,1 sleep 5 next for a=0 to 7 pallette rgb(0,7-a,a),0,1 sleep 5 next wend interruptstartgame: if joypad()=0 then return disable interrupt vblank shlink startgame startgame: level=1 score=0 speed=400 loadtiles sprites,7,256 redrawgame: disable screen ' turn off the screen b/c we're setting it up ink 0 a=level-1%8 reload level_colors for b=0 to a readint c next pallette c,0,1 cls ' clear the screen dim baddies(31) as integer ' define the baddy sprite table dim baddylaser(5) as integer propsprite ship,256,0 ' sets the sprite and color for the ship movesprite ship,278,336 laser=0 ' add a sprite for the player's laser i=0 ' first baddy is number 0 for y=0 to 3 ' loop for x=0 to 7 ' loop a=addsprite(2,2) movesprite a,32*x+144,32*y propsprite a,259,0 baddies(i)=a i=i+1 next next for a=0 to 5 baddylaser(a)=0 next baddiesdir=0 baddiesmove=0 baddiesturn=0 baddiesshoot=0 locate 0,0: print "Level: ";level; locate 0,10: print "Score: ";score; enable screen sleep 10 for y=0 to 80 for a=0 to 31 shiftsprite baddies(a),0,2 next sleep 1 next on vblank gosub gamejoypad enable interrupt vblank laserturn=0 lasernum=0 left=32 drawloop: if baddiesturn=speed then baddiesturn=0 if baddiesdir=0 then dx=0:dy=-1 elseif baddiesdir=1 then dx=1:dy=0 elseif baddiesdir=2 then dx=0:dy=1 elseif baddiesdir=3 then dx=-1:dy=0 endif for a=0 to 31 if baddies(a)<>0 then shiftsprite baddies(a),dx,dy endif next a=0: while a<>6 if baddylaser(a)=0 then b=rnd(31) if baddies(b)<>0 then baddylaser(a)=addsprite(1,1) movesprite baddylaser(a),spriteposx(baddies(b))+4,spriteposy(baddies(b))+16 propsprite baddylaser(a),257,0 endif endif a++: wend baddiesmove=baddiesmove+1 if baddiesmove=32 then baddiesdir=baddiesdir+1%4 baddiesmove=0 endif a=0: while a<>6 if baddylaser(a)<>0 then shiftsprite baddylaser(a),0,1 if spriteposy(baddylaser(a))=336 then if spriteposx(baddylaser(a))+3spriteposx(ship) then goto loser endif elseif spriteposy(baddylaser(a))=360 then freesprite baddylaser(a) baddylaser(a)=0 endif endif a++: wend endif if laserturn=6 then laserturn=0 if laser<>0 then if spriteposy(laser)>>2=spriteposy(baddies(lasernum))+14>>2 then if spriteposx(laser)+3spriteposx(baddies(lasernum)) then movesprite baddies(lasernum),0,0 ' freesprite baddies(lasernum) baddies(lasernum)=0 freesprite laser laser=0 score=level<<4+score dalt locate 0,10: print "Score: ";score; left-- if left=0 then goto winner endif endif lasernum++ if lasernum=32 then lasernum=0 shiftsprite laser,0,-4 if spriteposy(laser)<120 then freesprite laser laser=0 if score>level then score=score-level locate 0,10: print "Score: ";score; endif endif endif endif laserturn++ baddiesturn++ goto drawloop gamejoypad: j=joypad() if j.2 [and] spriteposx(ship)<>128 then shiftsprite ship,-2,0 if j.3 [and] spriteposx(ship)<>440 then shiftsprite ship,2,0 if j.6 [and] laser=0 then laser=addsprite(1,1) propsprite laser,258,0 movesprite laser,spriteposx(ship),spriteposy(ship)-8 endif return killgame: disable interrupt vblank disable screen movesprite ship,0,0 if laser<>0 then freesprite laser a=0: while a<>6 if baddylaser(a)<>0 then freesprite baddylaser(a) a++: wend a=0: while a<>32 freesprite baddies(a) a++: wend cls enable screen return winner: gosub killgame locate 10,10: print "OMG! U r teH WinNerZ!" locate 12,10: print "Score: " b=0 a=0: while a128: wend level++ speed=speed-100 goto redrawgame loser: gosub killgame locate 10,10: print "ono Game Over!" locate 12,10: print "Score: " b=0 a=0: while a128: wend goto title level_colors: dataint %000111011101110 dataint %000111000000000 dataint %000111011100000 dataint %000000011100000 dataint %000000011101110 dataint %000000000001110 dataint %000111000001110 dataint %000100010001000 sprites: datalong $00011000 ' 256: Ship datalong $00011000 datalong $00111100 datalong $10111101 datalong $10111101 datalong $10111101 datalong $11111111 datalong $11111111 datalong $00000000 ' 257: Baddy Laser datalong $00111100 datalong $00111100 datalong $00111100 datalong $00111100 datalong $00111100 datalong $00111100 datalong $00011000 datalong $00011000 ' 258: Ship Laser datalong $00111100 datalong $00111100 datalong $00111100 datalong $00111100 datalong $00111100 datalong $00111100 datalong $00000000 datalong $11000000 ' 259: Baddy 1 Sprite 16*16 datalong $11000000 datalong $11000000 datalong $11000000 datalong $11000000 datalong $11100000 datalong $11111111 datalong $11111111 datalong $11111111 datalong $11111111 datalong $11111111 datalong $11111111 datalong $01000000 datalong $01000000 datalong $00100000 datalong $00011111 datalong $00000011 datalong $00000011 datalong $00000011 datalong $00000011 datalong $00000011 datalong $00000111 datalong $11111111 datalong $11111111 datalong $11111111 datalong $11111111 datalong $11111111 datalong $11111111 datalong $00000010 datalong $00000010 datalong $00000100 datalong $11111000