Jump to content
Spartans Home

SpartaVaders


CoBoL~SPARTA~
 Share

Recommended Posts

Fedup of COD, ARMA, FARCRY, GTR, GRID, EVE.

 

Then worry no more, I treated you all to the latest is SFX & GFX. You will not experiance anything like this ever again (Honest).

 

 

SPARTAVADERS

 

Help Steve Sparta save the world for horible monster.

 

 

System Spec

 

CPU : If Its Got One

HD: Floppy will do.

RAM: ZX 16KB expansion required.

VIDEO: B&W TV

 

 

Instructions

 

Press 1 to Play the Game you have been waiting for

Press 2 to return to COD, and miss a life of joy.

 

Arrow keys to Move Steve Left & Right, and Press Space Bar for the BFG

 

IPB Image

 

IPB Image

 

 

This release is final. There will be no patches as its perfect.

 

 

 

Yes, I was board again.

SpartaVaders.rar

Link to comment
Share on other sites

The game as been so popular, I have decided to make it open source. For all you modders and maps makers (There is no map).

 

Hopefully there will be a popular following using this unique game engine. LOL

 

 

REM Project: SpartaVaders



   type monstertype
      id as integer ` sprite id
      xpos# as float
      ypos# as float
      state as boolean
   endtype
   dim monster(9) as monstertype

   type bullettype
      id as integer ` sprite id
      xpos# as float
      ypos# as float
      speed# as float
      destroy as boolean
   endtype
   dim bullet() as bullettype

   type livestype
      xpos as integer
      ypos as integer
      id as integer` sprite id
      state as boolean ` life used or not
   endtype
   dim lives(2) as livestype

   type barriertype
      xpos as integer
      ypos as integer
      id as integer
      state as integer ` 0 = full, 4 = dead
   endtype
   dim barrier(2) as barriertype
   dim barrierimg(3)

   type monstershoottype
      xpos# as float
      ypos# as float
   endtype
   MonsterShoot# as monstershoottype

Initialize()
Menu()
`PlayGame()

function PlayGame() ` play the game
InitializeGame()
PlayLevel()
endfunction


function InitializeGame() ` start of game init
InitializeData()

if Game_Loaded = 0
LoadObjects()
SetupObjects()
LoadSounds()
endif

Game_Loaded = 1
endfunction

   function LoadObjects()



      barrierimg(0) = freeimg()
      load image "Media\Images\barrier_1.png", barrierimg(0)
      barrierimg(1) = freeimg()
      load image "Media\Images\barrier_2.png", barrierimg(1)
      barrierimg(2) = freeimg()
      load image "Media\Images\barrier_3.png", barrierimg(2)
      barrierimg(3) = freeimg()
      load image "Media\Images\barrier_4.png", barrierimg(3)

   alien = freeimg()
   load image "Media\Images\alien.png",alien
   gamebackground = freeimg()
   load image "Media\Images\gamebackground.jpg",gamebackground
   playerimage = freeimg()
   load image "Media\Images\player.png",playerimage

   bulletimage = freeimg()
   get image bulletimage,0,0,4,10

    WinImage = freeimg()
   load image "Media\Images\win.png", WinImage
   LoseImage = freeimg()
   load image "Media\Images\lose.png", LoseImage

   cls
   endfunction

   function SetupObjects()
   player = freesprite()
   sprite player,225,400,playerimage
   offset sprite player, image width(playerimage)/2, image height(playerimage)/2 ` player sprite
   for i = 0 to array count(monster())
      monster(i).id = freesprite()
      sprite monster(i).id, monster(i).xpos#, monster(i).ypos#, alien
      offset sprite monster(i).id,image width(alien)/2, image height(alien)/2
   next i
   bulletspr = freesprite()
   sprite bulletspr,0,0,bulletimage
   offset sprite bulletspr,image width(bulletimage)/2, image height(bulletimage)/2
   hide sprite bulletspr

   for i = 0 to 2
      lives(i).id = freesprite()
      lives(i).xpos = 290+50*i
      lives(i).ypos = -5
      sprite lives(i).id, lives(i).xpos, lives(i).ypos, playerimage
   next i

   for i = 0 to 2
      barrier(i).id = freesprite()
      sprite barrier(i).id,0,0,barrierimg(0)
      barrier(i).xpos = 150*(i+1)-110
      barrier(i).ypos = 350
   next i


   endfunction

   function LoadSounds()

   zap = freesound()
   load sound "Media\Sounds\zap.wav", zap
   hit = freesound()
   load sound "Media\Sounds\hit.wav", hit
   monsterdie = freesound()
   load sound "Media\Sounds\monsterdie.wav", monsterdie
   B_music = 1
   load music "Media\Sounds\backgroundmusic.mid", B_music

   endfunction

   function InitializeData()
      global score as integer
      global lives as integer
      global xpos# as float : xpos# = 225
      global ypos# as float : ypos# = 420
      global Mon_xpos# as float
      global Mon_ypos# as float
      global movement as integer
      global T_elapsed# as float ` change to integer
      global T_initial# as float
      global B_elapsed as integer
      global B_initial as integer
      global M_initial as integer ` monster shoot timer
      global M_elapsed as integer
      global direction as integer : direction = 1
      global M_initx# as float
      global M_inity# as float : M_inity# = 70 ` start y position
      global MonsterSpeed as integer : MonsterSpeed = 200
      global BulletDelay as integer : BulletDelay = 1500
      global MonsterShootDelay as integer : MonsterShootDelay = 400
      global PlayerSpeed as integer : Playerspeed = 3
      global BulletSpeed as integer : BulletSpeed = 6

      global gamebackground as integer
      global alien as integer
      global playerimage as integer
      global bulletimage as integer
      global bulletspr as integer
      global barrier1 as integer
      global barrier2 as integer
      global barrier3 as integer
      global barrier4 as integer
      global WinImage as integer
      global LoseImage as integer
      global player as integer

      global zap as integer
      global hit as integer
      global monsterdie as integer ` sounds
      global B_music as integer

      #Constant Cplayer 1
      #constant Cmonster 2
      #constant cWin 3

   endfunction

function PlayLevel()
   show all sprites
   play music B_music
   do ` main game loop
      handlePlayer()
      handleMonsters()
      handleBarriers()
      handleBullets()
      draw()
      sync
   loop
endfunction

   function handleBarriers()
      for i = 0 to 2
       if barrier(i).state <> 8 ` barrier is broken
         sprite barrier(i).id,barrier(i).xpos, barrier(i).ypos, barrierimg(barrier(i).state/2)

         if array count(bullet()) > -1 ` same code as monstercollision
         for z = 0 to array count(bullet())
            if sprite exist(bullet(z).id) and sprite exist(barrier(i).id)
               if sprite collision(barrier(i).id, bullet(z).id) = 1
                  bullet(z).destroy = 1 ` destroy bullet
                  inc barrier(i).state
                  if barrier(i).state = 8 then delete sprite barrier(i).id
               endif
            endif
         next z
         endif
       endif
      next i



   endfunction

   function handlePlayer()
   if leftkey() and xpos#>30 then dec xpos#,PlayerSpeed
   if rightkey() and xpos#<420 then inc xpos#,PlayerSpeed
   if spacekey() then shoot(Cplayer)
   sprite player,xpos#,ypos#,playerimage

   playerCollision()

   endfunction

      function playerCollision()

         if array count(bullet()) > -1 ` same code as monstercollision
         for z = 0 to array count(bullet())
            if sprite exist(bullet(z).id)
               if sprite collision(player, bullet(z).id)
                  bullet(z).destroy = 1` destroy bullet
                  playerHit()
               endif
            endif
         next z
         endif

      endfunction

      function playerHit()
         play sound hit
         x = -1
         repeat
               inc x
               if x = 3 then Endgame(0) ` all lives used up if 3
               if lives(x).state = 0
                  lives(x).state = 1
                  y = 1
               endif
         until y = 1

      endfunction

   function handleMonsters()
      i = -1
      for i = 0 to array count(monster())
         inc MonsterExists, monster(i).state` check for monsters
      next i

      if MonsterExists <> array count(monster())+1
         moveMonsters() ` monster collision is in here
         monsterShoot()
      else
         Endgame(cWin)
      endif

   endfunction

      function monsterShoot()
         M_elapsed = timer() - M_initial
         if M_elapsed > MonsterShootDelay
            M_initial = timer()
            repeat : rand = rnd(9) : until monster(rand).state = 0
            if rand <= 4 then increased = 60
            MonsterShoot#.xpos# = monster(rand).xpos#
            MonsterShoot#.ypos# = monster(rand).ypos# + increased
            shoot(cMonster)
         endif

      endfunction


      function moveMonsters()

         T_elapsed# = timer()-T_initial#
         if T_elapsed# >= MonsterSpeed
            inc movement,20
            T_initial# = timer() ` timer movement, every second
         endif

         if movement >= 220  ` back and forth movement
            movement = 0-movement
            direction = -1
            inc M_inity#,20
         endif

         if direction = -1
            if movement >-40
               movement = -movement
               direction = 1
               inc M_inity#,20
            endif
         endif

         if M_inity# >= 300 then EndGame(LOSE) ` lose being zero

         for i = 0 to array count(monster()) ` draw monsters in positions
            if i >= 5 ` whether it should be moved down
               monster(i).ypos# = M_inity#+50
               a = 5
            else
               monster(i).ypos# = M_inity#
            endif

            monster(i).xpos# = direction*movement + 50*(i-a) ` change it to move depending on location of initial y and x
            if monster(i).state = 0 ` only draw and check collision if still alive
               sprite monster(i).id,monster(i).xpos#,monster(i).ypos#,alien
               monsterCollision(i)
            endif
         next i
      endfunction

      function monsterCollision(i)
      if array count(bullet()) > -1
      for z = 0 to array count(bullet())
         if sprite exist(bullet(z).id) and sprite exist(monster(i).id)
            if sprite collision(monster(i).id, bullet(z).id) = 1
               bullet(z).destroy = 1` destroy bullet
               monsterDeath(i)
            endif
         endif
      next z
      endif

      endfunction

      function monsterDeath(monsterID)
         delete sprite monster(monsterID).id
         monster(monsterID).state = 1
         play sound monsterdie
      endfunction

   function shoot(source)

      IF source = Cplayer ` if player is shooting
       B_elapsed = timer() - B_initial
       if B_elapsed >= BulletDelay
          B_initial = timer()
          play sound zap
          add to queue bullet()
          bullet().id = freesprite()
          clone sprite bulletspr,bullet().id
          bullet().speed# = -BulletSpeed
          bullet().ypos# = ypos#-30
          bullet().xpos# = xpos#
          sprite bullet().id, xpos#, bullet().ypos#, bulletimage ` spawn bullet above player
       endif
      ELSE ` if monster is shooting
          add to queue bullet()
          bullet().id = freesprite()
          clone sprite bulletspr,bullet().id
          bullet().speed# = BulletSpeed
          bullet().ypos# = MonsterShoot#.ypos#+30
          bullet().xpos# = MonsterShoot#.xpos#
          sprite bullet().id, bullet().xpos#, bullet().ypos#, bulletimage ` spawn bullet below monster

      ENDIF
   endfunction

   function handleBullets()
      for i = 0 to array count(bullet()) ` movement loop
         inc bullet(i).ypos#,bullet(i).speed#
         sprite bullet(i).id, bullet(i).xpos#, bullet(i).ypos#, bulletimage
         if bullet(i).ypos#<35 or bullet(i).ypos#>450 then bullet(i).destroy = 1 ` : print "bam" :wait 2000: sync
      next i

      if array count(bullet()) > -1 ` bullet deleting code, if the last fired bullet is to be destroyed, finish the job.
         for i = 0 to array count(bullet())
            if bullet(i).destroy = 1
               delete sprite bullet(i).id
               array delete element bullet(),i
            endif
         next i
      endif

   endfunction

   function draw()
   paste image gamebackground,0,0

   for i = 0 to 2
      if lives(i).state = 0
         sprite lives(i).id, lives(i).xpos, lives(i).ypos, playerimage
      else
         hide sprite lives(i).id
      endif
   next i


   endfunction


function Endgame(WhoWins)
hide all sprites
if WhoWins = cWin
   paste image gamebackground,0,0
   paste image WinImage, screen width()/2 - image width(WinImage)/2, screen height()/2 - image height(WinImage)/2
   sync
   wait 3000
   end
else
   paste image gamebackground,0,0
   paste image LoseImage, screen width()/2 - image width(LoseImage)/2, screen height()/2 - image height(LoseImage)/2
   sync
   wait 3000
   end
endif
endfunction




function Initialize() ` start of application init
sync on
sync rate 60
global menu_loaded as boolean
global Game_loaded as boolean
set window on
set window size 449,449
set display mode 449,449,32
set window title "SpartaVaders - CoBoL"
endfunction

function Menu()
   if menu_loaded = 0 then loadmenu()
   repeat
      paste image menubackground,0,0 : sync
      a$ = inkey$()
   until a$ = "1" or a$ = "2"
   select a$
      case "1"
      PlayGame()
      endcase
      case "2"
         end
      endcase
   endselect


endfunction

   function loadmenu()
   global menubackground as integer
   menubackground = freeimg()
   load image "Media/Images/menubackground.jpg",menubackground
   menu_loaded = 1
   endfunction


function freeimg()
repeat
   inc i
until image exist(i) = 0
endfunction i

function freesprite()
repeat
   inc i
until sprite exist(i) = 0
endfunction i

function freesound()
repeat
   inc i
until sound exist(i) = 0
endfunction i

 

 

Have fun :)

Link to comment
Share on other sites

It could be you need to copy and burn it to disk and then unzip it and re rar it then extract it to anouther folder and then copy it back to desk top and alter command line in dos to C:/ command line self destruct p/c SET UPEXE. Drag and drop this line into that folder but you have to delete C:/ first to get it to work LOL!

Edited by Athlon64~SPARTA~
Link to comment
Share on other sites

  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...