Chuck Norris VS Star Wars by trouper20th Jan 2006 17:10
|
---|
Summary Be Chuck Norris as you round house kick Star Wars things. Description Use space bar and arrow keys < & >. Watch for Quick Time Events. This is like my second game ever. Wish I could have done a better job, still new to programming. It was made in Dark Basic Standard. Any questions/comments/complaints are welcome, exiguousmikey@msn.com. Oh Yeah! I am in no way affiliated with Chuck Norris or Star Wars/Lucas Arts in anyway. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `Chuck Norris vs Star Wars``````Michael S.[exiguousmikey@msn.com]``````Jan. 2006 sync on : sync rate 60 : if check display mode(1024,768,32)=1 then set display mode 400,300,32 hide mouse load music "texas ranger theme.mp3",1 : play music 1 load bitmap "start_screen.jpg",0 : suspend for key : stop music 1 ink rgb(255,255,255),1 : print "Loading..." REM ---INFO FOR PARTICLES--- rem Arrays for position, velocity and life of each particle dim partx#(300) dim party#(300) dim partz#(300) dim partxvel#(300) dim partyvel#(300) dim partzvel#(300) dim partlife(300) inten#=50 camz#=500 rem User prompt dim max(1) max(1)=99 rem Make the particle objects, starting from object 50 sync on for t=1 to max(1) : make object plain (50+t),5,5 : next t color backdrop 0 start: rem random for backgrounds; rnd(4)+1 because bitmap 0 can't be used randomize timer() random = rnd(2)+1 t=timer() score=0 x#=185 rem load media load music "bgmusic.mid",2 load sound "hit.mp3",1 load sound "kick.mp3",2 load sound "flyby.mp3",3 load sound "explode.mp3",4 load sound "tie_flyby.mp3",5 load sound "saber.mp3",6 load bitmap "level2.jpg",1 : blur bitmap 1, 1.5 load bitmap "level3.jpg",2 : blur bitmap 2, 1.5 load bitmap "level4.jpg",3 : blur bitmap 3, 1.5 load bitmap "chuck.bmp",6 : get image 6,0,0,45,117 : delete bitmap 6 load bitmap "chuck.bmp",7 : mirror bitmap 7 : get image 7,0,0,45,117 : delete bitmap 7 load bitmap "chuck_attack.bmp",8 : get image 8,0,0,80,117 : delete bitmap 8 load bitmap "chuck_attack.bmp",9 : mirror bitmap 9 : get image 9,0,0,80,117 : delete bitmap 9 load bitmap "r2_left.bmp",10 : get image 10,0,0,60,75 : delete bitmap 10 load bitmap "r2_right.bmp",11 : get image 11,0,0,65,75 : delete bitmap 11 load bitmap "xwing.bmp",12 : get image 12,0,0,150,100 : delete bitmap 12 load bitmap "b_button.bmp",13 : get image 13,0,0,25,25 : delete bitmap 13 load bitmap "chuck_blast.bmp",14 : get image 14,0,0,45,163 : delete bitmap 14 load bitmap "xwing_crash.bmp",15 : get image 15,0,0,150,100 : delete bitmap 15 load bitmap "tie.bmp",16 : get image 16,0,0,75,75 : delete bitmap 16 load bitmap "tie_crash.bmp",17 : get image 17,0,0,75,75 : delete bitmap 17 load bitmap "xwing.bmp",18 : mirror bitmap 18 : get image 18,0,0,150,100 : delete bitmap 18 load bitmap "c_button.bmp",19 : get image 19,0,0,25,25 : delete bitmap 19 load bitmap "a_button.bmp",20 : get image 20,0,0,25,25 : delete bitmap 20 load bitmap "mace_stance.bmp",21 : get image 21,0,0,140,120 : delete bitmap 21 rem chuck starts off sprite 1,185,185,6 rem enemy starts off sprite 2,200,230,10 rem enemy2 starts off sprite 3,-20,230,11 rem Main loop do rem play music for level loop music 2 rem copy bitmap-levels at random copy bitmap random,0 draw to back rem restart the game if keystate(41)=1 then goto end: rem press tab for FPS ink rgb(255,255,255),1 : set cursor 340,1 : if keystate(15)=1 : print "FPS: ", screen fps() : endif rem welcome text if time<=120 and time>=119 ink rgb(255,0,0),9 : set text size 15 : text 149,50,"Game Started" endif rem score stuff ink rgb(192,192,192),2 : set text size 30 : text 5,2,"SCORE: "+str$(score)+"" rem timer stuff ink rgb(192,192,192),3 : set text size 15 time=abs(((timer()-t)/1000)-60) text 5,35,"TIME: "+str$(time)+"" if time<=10 ink rgb(255,0,0),8 set cursor 5,50 : set text size 15 print "RUNNING OUT OF TIME" endif if time=0 goto end: endif rem ur score is !!! if time = 1 ink rgb(255,0,0),1 : set cursor 1,75 print "Your score is: "+str$(score)+"" endif rem for chuck sprite movements if go#=1 then inc cycle# if cycle#=10 and side#=1 then go#=0 : sprite 1,x#,185,7 : cycle#=0 if cycle#=10 and side#=2 then go#=0 : sprite 1,x#,185,6 : cycle#=0 rem for chuck sprite direction if leftkey()=1 then dec x#, 7 : sprite 1,x#,185,7 : side#=1 : go#=0 if rightkey()=1 then inc x#, 7 : sprite 1,x#,185,6 : side#=2 : go#=0 rem for chuck kick if spacekey()=1 and side#=1 and rnd(3)=1 then sprite 1,x#-35,185,9 : go#=1 : play sound 2 if spacekey()=1 and side#=2 and rnd(3)=1 then sprite 1,x#,185,8 : go#=1 : play sound 2 rem collision with walls if x# <= 85 then x# = x#+7 if x# >= 310 then x# = x#-7 REM ---ENEMY SECTION--- rem enemy position sprite 2,j+350,230,11 if j>100 then k=1 if k=1 : j=j-2 : else : j=j+2 : endif : if j<0 then k=0 rem damage enemy if sprite collision(1,2) and spacekey()=1 and rnd(3)=1 score = score + 25 play sound 1 ink rgb(255,0,0),4 : text j+362,200,"+25" x1#=j-125 y1#=-75 z1#=-50 request_explosion(x1#,y1#,z1#,max(1),inten#,80) endif rem enemy2 position sprite 3,l-50,230,10 if l>100 then m=10 if m=10 : l=l-2.5 : else : l=l+2.5 : endif : if l<0 then m=0 rem damage enemy2 if sprite collision(1,3) and spacekey()=1 and rnd(2)=1 score = score + 10 play sound 1 ink rgb(255,0,0),4 : text l-42,200,"+10" x2#=l+900 y2#=-250 z2#=-50 request_explosion(x2#,y2#,z2#,max(1),inten#,80) endif `************************************* REM MACE BOSS sprite 15,x+100,185,21 : hide sprite 15 if time = 20 play sound 6 endif if time <=19 and time >=0 show sprite 15 sprite 15,x+100,185,21 if x>100 then y=10 if y=10 : x=x-4 : else : x=x+4 : endif : if x<0 then y=0 rem damage mace if sprite collision(1,15) and spacekey()=1 and rnd(3)=1 score = score + 50 play sound 1 ink rgb(255,0,0),4 : text x+130,170,"+50" endif rem mace damage chuck if sprite collision(1,15) and rnd(7)=1 score = score - 25 play sound 1 ink rgb(255,0,0),4 : text x#,170,"-25" endif endif `************************************** REM OTHER ENEMIES rem flying enemy sprite 4,n,20,12 : hide sprite 4 sprite 5,180,138,13 : hide sprite 5 sprite 6,x#+7,44,14 : hide sprite 6 sprite 7,n,20,15 : hide sprite 7 sprite 8,p,20,16 : hide sprite 8 sprite 9,p,20,17 : hide sprite 9 sprite 10,3,20,18 : hide sprite 10 sprite 11,180,138,19 : hide sprite 11 sprite 12,r,20,16 : hide sprite 12 sprite 13,r,20,17 : hide sprite 13 sprite 14,180,138,20 : hide sprite 14 REM FLYING ENEMY SECTION========================================== `rem flying enemy 1```````````````````````````````````````````````` if time<=50 if n>100 then o=1 if n=1 : n=n-3 : else : n=n+3 : endif : if n<0 then o=0 show sprite 4 endif if time=51 play sound 3 endif if time<=48 hide sprite 4 n=0 endif rem press b quickly if time<=50 and time>=49 and keystate(48)=0 ink rgb(255,0,0),5 : text 140,120, "Press 'B' quickly" endif if time<=50 and time>=49 and keystate(48)=0 and rnd(1)=1 show sprite 5 endif rem kill flying enemy if time<=50 and time>=49 and keystate(48)=1 and rnd(5)=1 score=score+100 play sound 4 show sprite 6 show sprite 7 endif `````````````````````````````````````````````````````````````````` `rem flying enemy 2``````````````````````````````````````````````` if time<=40 if p>100 then q=1 if p=1 : p=p-5 : else : p=p+5 : endif : if p<0 then q=0 show sprite 8 endif if time=41 play sound 5 endif if time<=38 hide sprite 8 p=0 endif rem press c quickly if time<=40 and time>=39 and keystate(46)=0 ink rgb(255,0,0),5 : text 140,120, "Press 'C' quickly" endif if time<=40 and time>=39 and keystate(46)=0 and rnd(1)=1 show sprite 11 endif rem kill flying enemy if time<=40 and time>=39 and keystate(46)=1 and rnd(3)=1 score=score+100 play sound 4 show sprite 6 show sprite 9 endif `````````````````````````````````````````````````````````````````` `rem flying enemy 3``````````````````````````````````````````````` if time<=30 if r>100 then s=1 if r=1 : r=r-5 : else : r=r+5 : endif : if r<0 then s=0 show sprite 12 endif if time=31 play sound 5 endif if time<=28 hide sprite 12 p=0 endif rem press a quickly if time<=30 and time>=29 and keystate(30)=0 ink rgb(255,0,0),5 : text 140,120, "Press 'A' quickly" endif if time<=30 and time>=29 and keystate(30)=0 and rnd(1)=1 show sprite 14 endif rem kill flying enemy if time<=30 and time>=29 and keystate(30)=1 and rnd(3)=1 score=score+100 play sound 4 show sprite 6 show sprite 13 endif `````````````````````````````````````````````````````````````````` REM ============================================================== rem camera for explosion effect... im lazy -.- position camera -100,100,camz# point camera 150,150,150 rem this function must be called once every cycle to deal with the particles handle_explosion rem sync cls loop rem end game/restart game end: goto start rem functions: rem ----------------- rem request explosion function request_explosion(ex2#,ey2#,ez2#,particles,intensity#,life) t=0:p=0 repeat t=t+1 rem if the particular particle (gettit?) is not busy... (is dead): if partlife(t)=0 p=p+1 rem ...make it alive... partlife(t)=life + rnd(life/5) rem ....put it at the center of the explosion.... partx#(t)=ex2# party#(t)=ey2# partz#(t)=ez2# rem ...and give it some push. partyvel#(t)=rnd(intensity#)-(intensity#/2) partxvel#(t)=rnd(intensity#)-(intensity#/2) partzvel#(t)=rnd(intensity#)-(intensity#/2) rem ...oh, and make it visible! show object (50+t) endif rem if the number of particles requested is met, exit the loop if p>=particles then exit until t>=max(1) endfunction rem ---------------- rem handle explosion function handle_explosion() for t=1 to max(1) rem if the particle is alive... if partlife(t)>1 partlife(t) = partlife(t) - 1 position object 50+t,partx#(t),party#(t),partz#(t) rem calculate friction partxvel#(t)=partxvel#(t)*0.95 partyvel#(t)=partyvel#(t)*0.95 partzvel#(t)=partzvel#(t)*0.95 rem and gravity... partyvel#(t)=partyvel#(t)-0.5 rem and add the acceleration values to the actual coordinates. partx#(t) = partx#(t) + partxvel#(t) party#(t) = party#(t) + partyvel#(t) partz#(t) = partz#(t) + partzvel#(t) rem if it hits the ground, reverse its horisontal acceleration so it bounces if party#(t)<=0 then partyvel#(t)=partyvel#(t)*-0.7 rem do some random rotation so it looks good... rotate object t+50,wrapvalue(object angle x(t+50)+rnd(50)),wrapvalue(object angle y(t+50)+rnd(50)),0 endif rem if particle is close to dying... if partlife(t)=1 rem ...make it dead partlife(t)=0 rem ...and hide it too. hide object 50+t endif next t endfunction |