Rocket Episode III by Trek25th Oct 2005 8:18
|
---|
Summary A modified version of Rockets 2. Description I downloaded Darthman's production Rockets 2 the other day and really liked the concept. So I debugged a couple things, added a new sound scheme, and put in some new features. Please note, all credit for this goes to David and Brian Williams (aka Darthman). If you want to use portions of it in your games or anything like that, they're the people to ask. I just modified their game to make it run a little smoother. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ` Rocket Episode III ` Originally Written By David & Brian Williams ` Modified by Trek Manager D3 ` Setup screen and limit sync rates so that the game isn't over in a nanosecond. start: Hide Mouse sync on sync rate 30 autocam off position camera 0,0,0 point camera 0,0,5 ` Made a plain object out of sight so that the 3D backdrop would be activated if object exist(1)=0 then make object plain 1,1,1 if object exist(1)=0 then position object 1,0,0,-5 color backdrop rgb(0,0,10) ` Loads music first time through program and then plays it using the wait commands ` since without those, because of a weird glitch, the music will only play the ` first time the play music command is called. if Music Exist(5)=0 then load music "Intro.wma",5 stop music 5 wait 100 play music 5 wait 100 ` Intro menu with optional controls display controls=0 do center text 320,30,"Rocket Episode III" center text 320,100,"Original Code By David & Brian Williams" center text 320,150,"Modified by Trek Manager D3" center text 320,250,"The Anti-Earth Missiles" center text 320,300,"Press Enter To Start - Press 'c' for controls" if controls=1 center text 320,350,"Controls:" center text 320,390,"Move up - Up arrowkey | Move down - Down arrowkey" center text 320,420,"Shoot - Spacebar" endif if returnkey()=1 then goto game if inkey$()="c" or inkey$()="C" then controls=1 sync loop game: ` The program checks to see whether the sounds exist before loading them since ` if they are already loaded and the program attempts to load them again, you get ` a run-time error. if Music Exist(2)=0 then load Music "EndLevel.wma",2 if Music Exist(3)=0 then load Music "HitMissile.wma",3 if Sound Exist(1)=0 then load sound "ElectroShot.wav",1 if Sound Exist(2)=0 then load sound "HitWall.wav",2 ` Variable setup. No changes made here. DIM bx(500) DIM by(500) bax1=40:bay1=0:bax2=40:bay2=600 ex1=700:ey1=Rnd(460) ex2=700:ey2=Rnd(460) ex3=700:ey3=Rnd(460) ex4=700:ey4=rnd(460) plx=100:ply=300 b=0:a=1:t=0 points#=0 sync on color backdrop rgb(155,0,0) do ` Made ship a little more triangular by adjusting line y positions. line bax1,bay1,bax2,bay2 line plx,ply,(plx-50),(ply-5) line plx,ply,(plx-50),(ply+5) line (plx-50),(ply+5),(plx-50),(ply-5) ` Made ship a little faster for longer games. If upkey()=1 then ply=ply-5 If downkey()=1 then ply=ply+5 ` If the fire trigger is above 5 and the spacekey is no longer being pressed ` activate the fire trigger so that the player can shoot again by pressing the spacebar t#=t#+.5 if t#>=5 and spacekey()=0 then t#=11 ex1=ex1-5 if points#>5 then ex2=ex2-5 if points#>10 then ex3=ex3-5 if points#>15 then ex4=ex4-5 box ex1,ey1,(ex1+30),(ey1+20) box ex2,ey2,(ex2+30),(ey2+20) box ex3,ey3,(ex3+30),(ey3+20) box ex4,ey4,(ex4+30),(ey4+20) ` Nothing changed here but this block will now make sure the player ` can only get one shot each time he/she presses the spacebar after a minor time ` delay. That way they can't just hold it down and get machine gun fire. if t#>10 if spacekey()=1 play sound 1 t#=0 b=b+1 bx(b)=plx by(b)=ply endif endif ` Added a label for the points readout so the player knows what that number stands for text 0,10,"Score" text 10,30,STR$(points#) ` Moves bullet and if the bullet hits the wall, it plays a thump sound. For c=a to b circle bx(c),by(c),1 bx(c)=bx(c)+10 If bx(c)>640 then a=a+1 : play sound 2 next c if ex1=0 sync off goto theend endif if ex2=0 sync off goto theend endif if ex3=0 sync off goto theend endif if ex4=0 sync off goto theend endif if ply<10 then ply=500 if ply>510 then ply=10 ` It now checks collision for all bullets not just the last one fired and displays a ` primitive explosion effect by refreshing the screen to show the red background. for c=a to b if bx(c)>(ex1+10) and bx(c)<(ex1+40) and by(c)>(ey1) and by(c)<(ey1+40) sync stop music 3 wait 50 play music 3 points#=points#+1 ex1=700 ey1=rnd(400) endif if bx(c)>(ex2+10) and bx(c)<(ex2+40) and by(c)>(ey2) and by(c)<(ey2+40) sync stop music 3 wait 50 play music 3 points#=points#+1 ex2=700 ey2=rnd(400) a=a+1 endif if bx(c)>(ex3+10) and bx(c)<(ex3+40) and by(c)>(ey3) and by(c)<(ey3+40) sync stop music 3 wait 50 play music 3 points#=points#+1 ex3=700 ey3=rnd(400) a=a+1 endif if bx(c)>(ex4+10) and bx(c)<(ex4+40) and by(c)>(ey4) and by(c)<(ey4+40) sync stop music 3 wait 50 play music 3 points#=points#+1 ex4=700 ey4=rnd(400) endif next n sync cls loop theend: color backdrop rgb(0,0,10) stop music 2 wait 100 play music 2 wait 100 do center text 320,30,"Game Over!!" center text 320,100,"Your final score was " + STR$(points#) + " points" center text 320,250,"Press 'Enter' To Replay" if returnkey()=1 then wait 100 : goto start loop |