THE LONE VADER by Anonymous Coder26th Jan 2004 10:32
|
---|
Summary SIMPLE JOYSTICK DEMO Description SIMPLE HOYSTICK DEMO WITH ONE SPACE INVADER AND ONE HERO. SHOOT THE VADER AS MANY TIMES AS YOU CAN. THE SCORE FOR YOU AND THE VADER WILL BE DISPLATED AT THE END. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ` the lone vader ` Mike Trombley ` 143 Old Belchertown Rd. ` Ware mass 01082 CLS hide mouse sync on sync rate 60 randomize timer() load sound "lasergun.wav",1 load sound "pdestroy.wav",2 box 33,10,37,38 box 26,18,44,38 get image 1,24,11,44,38 ink rgb(255,250,2),0 rem sprite 1,24,11,1 ellipse 110,32,24,6 ellipse 109,31,23,6 line 110,38,110,44 line 109,38,109,44 ink rgb(255,255,255),0 line 98,30,102,30 line 98,29,102,29 line 118,30,122,30 line 118,29,122,29 get image 2,86,26,135,43 ink rgb(255,255,255),0 rem tank shot circle 70,8,2 get image 3,66,3,74,14 ink rgb(255,250,2),0 circle 200,8,2 rem vader shot circle 200,8,2 get image 4,196,3,204,14 sprite 1,0,0,1 sprite 2,0,0,2 sprite 3,0,0,3 sprite 4,0,0,4 cls rgb(0,0,0) ink rgb(255,214,210),1 for t = 1 to 100 ink rnd(32000),1 dot rnd(640),rnd(680) next t do randomize timer() shotspeed# = 12 shotvspeed=5 tankx = 320 : tanky = 450 vaderyspeed# = 2.0 vaderxspeed# = 2.0 speedinc# = 0.2 tankspeed = 0 tankmove = 8 tank = 1 : vader = 2 : shot=3 : shotv=4 score = 0 repeat if joystick x()>100 tankspeed = tankmove else if joystick x()<-100 tankspeed = 0 - tankmove else tankspeed = 0 if joystick fire a()=1 and shotx#<4 then gosub shot:shotx#=455 endif endif if down < 20 then down = 10 if sprite collision(4,1) vaderscore = vaderscore + 10 endif if sprite collision(3,2) score = score + 10 shotx# = 0 down = down -10 vaderyspeed# = 0 - (abs(vaderyspeed#) + speedinc#) random# = (rnd(10)) vaderxspeed# = vaderxspeed# + (tankpeed/2) + random# score = score + 10 endif IF vaderx# > 580.0 or vaderx# < 0.0 then vaderxspeed# = 0.0 - vaderxspeed#:down=down+10 IF vadery# < 0.0 then vaderyspeed# = 0.0 + vadery randomv# = rnd(100) if randomv# = 10 then gosub shotv tankx = tankx + tankspeed vaderx# = vaderx# + vaderxspeed# vadery# = vadery# - vaderyspeed# shotx#=shotx#-shotspeed# shotv# = shotv#+shotspeed# if tankx < 4 then tankx = 4 if tankx > 608 then tankx = 608 sprite tank,tankx,tanky,tank sprite vader,vaderx#,vadery#+down+10,vader sprite shot,shotx+tankx+7,shotx#,shot sprite shotv,shotx+vadersh#+20,shotv#+down+20,shotv SYNC until down > 420 down = 0 shot: play sound 2 if shotx#<4 then shotx#=4 sync repeat shoty#= shoty#-4 until shoty#<4 return shotv: vadersh#=vaderx# play sound 1 if shotv# > 4 then shotv#=0 sync repeat shotv# = shotv#+shotv#-4 until shotv#<480 return ink rgb(255,0,0),1 cls text 260,200,"vader`s score: "+str$(vaderscore) text 264,230,"your Score: "+str$(score) text 175,250,"Press enter to play again, or spacebar to end" repeat sync until returnkey() or spacekey() if spacekey() then exit cls LOOP END |