Rem * Title : Basic Multiplayer
Rem * Author : DBS-LB
Rem * Date : October 2001
`*****************************************
`*****************************************
`***
`*** Chimera
`*** VERSION - Version 1
`*** DEVELOPER - Max Berger,Kyle,Jason,Chris,Brian Flaven
`*** COPYRIGHT - FootHill High School
`*** updated cracks on walls :>
`***
` ***
` *** START SYSTEM SETUP SECTION
` ***
sync on
sync rate 30
autocam on
position mouse 320,240
randomize timer()
` ***
` *** STOP SYSTEM SETUP SECTION
` ***
` ***************************************
` ***
` *** START INTRO SECTION
` ***
` ***
` *** INTRO SECTION HEADER
` ***
`SCREEN DISPLAY
cls 0
ink rgb(255,0,0),0
center text 320,220,"LOADING PLEASE WAIT"
`REFRESH SCREEN
sync
` ***
` *** INTRO SECTION LOOP
` ***
` do
`SCREEN DISPLAY
`CONTROL INPUT
`if keystate( scancode() ) = 1 then goto MainSection
`REFRESH SCREEN
sync
` loop
` ***
` *** END INTRO SECTION
` ***
` *****************************************
` ***
` *** START MAIN SECTION
` ***
` ***
` *** MAIN SECTION HEADER
` ***
MainSection:
`LOAD IMAGES
load image "bmp\gate.bmp",4
`LOAD SOUND
load sound "snd\Shell Shock.mp3",11
load sound "snd\Blue Monday.mp3",12
`load sound "snd\Untitled and Unloved.mp3",13
`load sound "snd\Im a Skatman.mp3",14
`load sound "snd\temptation.mp3",15
`SCREEN DISPLAY
cls 0
backdrop on
`TEXT
`HEADS-UP DISPLAY (HUD)
`OBJECT CREATION
make object cube 121,43
position object 121, -520,180,-650
color object 121,rgb(0,0,0)
make object sphere 120,30
position object 120, -510,180,-650
set object collision to spheres 120
`Lock
`load object "obj\newhelix.x",6
`position object 6, 270,60,-50
`scale object 6, 30,30,30
`load object "obj\newlockbox.x",7
`position object 7, 300,200,0
`set object 7,1,1,1
`load object "obj\newgear2.x",8
`position object 8, 400,260,20
`load object "obj\newgeararm-2.x",9
`position object 9, 0,-100,40
`load object "obj\newinversegear.x",10
`position object 10, 0,200,0
`Sound
Loop sound 12
`World Map
makeWall(100, 752,1003, 90,0,90, -700,0,-1005, 1,1,1, 3,1.0,1.0, 0) : `Floor
makeWall(115, 2502,1003, 90,0,90, 0,0,0, 1,1,1, 3,1.0,1.0, 0) : `Floor
makeWall(107, 2505,1005, 270,0,90, 2,498,0, 1,1,1, 3,1.0,1.0, 0) : `Ceiling
makeWall(101, 1003,504, 0,0,0, 0,250,1250, 1,0,1, 2,1.0,1.0, 1) : `North Train Wall
makeWall(102, 2003,504, 0,90,0, 500,250,250, 1,0,1, 2,2.0,1.0, 1) : `East Train Wall
makeWall(103, 2003,504, 0,270,0, -500,250,250, 1,0,1, 2,2.0,1.0, 1) : `West Train Wall
makeWall(104, 503,504, 0,90,0, 500,250,-1000, 1,1,1, 3,0.5,1.0, 1) : `SouthWest Train Wall
makeWall(105, 1003,504, 0,180,0, 0,250,-1250, 1,0,1, 2,1.0,1.0, 1) : `South Train Wall
makeWall(106, 503,504, 0,90,0, -500,250,-1000, 1,1,0, 3,0.5,1.0, 1) : `Divider Wall
sync
`Texture Gate
texture object 106,4
set object 106,1,0,0
yrotate object 106,90
set object collision on 106
`Posts
createPost(108,-500,250,1250)
createPost(109,500,250,1250)
createPost(110,-500,250,-750)
createPost(112,-500,250,-1250)
createPost(113,500,250,-1250)
`Player Character
make object cube 1,0
scale object 1, 100,200,100
position object 1, 0,100,500
`SET CAMERA
position camera 0,300,0
set camera range 5,10000
`REFRESH SCREEN
` ***
` *** MAIN SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`SPECIAL EFFECTS
`OBJECT ORIENTATIONS
1pX# = object position X(1)
1pY# = object position Y(1)
1pZ# = object position Z(1)
1aX = object angle X(1)
1aY = object angle Y(1)
1aZ = object angle Z(1)
`LIVE SCREEN DISPLAY
`CONTROL INPUT
`if mouse click on object 120
`then
`Acceleration
if Upkey()=1 then move object 1,20
if Downkey()=1 then move object 1,-20
`Turning
if Leftkey()=1 then 1aY = wrapvalue(1aY-7)
if Rightkey()=1 then 1aY = wrapvalue(1aY+7)
`View
`if mousemovex()=1 then 1aY = wrapvalue(1aY-7)
`if mousemovex()=1 then 1aY = wrapvalue(1aY+7)
`Quit Game
if Inkey$() = "q"
ClearWorld()
goto EndSection
endif
rem Use MOUSEMOVE to alter camera angles
`cx#=wrapvalue(cx#+mousemovey())
`cy#=wrapvalue(cy#+mousemovex())
`rotate camera cx#,cy#,cz#
`MOVE OBJECTS - PRE-COLLISION
`Player Character
new1pX# = object position X(1)
new1pY# = object position Y(1)
new1pZ# = object position Z(1)
Yrotate object 1,1aY
`CHECK COLLISION
`Check Player Character
`Wall Collision
s# = 50.0
if get static collision hit(1pX#-s#,1pY#-s#,1pZ#-s#, 1pX#+s#,1pY#+s#,1pZ#+s#, new1pX#-s#,new1pY#-s#,new1pZ#-s#, new1pX#+s#,new1pY#+s#,new1pZ#+s#) = 1
dec new1pX#, get static collision x()
dec new1pY#, get static collision y()
dec new1pZ#, get static collision z()
endif
`Set Post-Collision Object Orientation Values
`Player Character
position object 1,new1pX#,new1pY#,new1pZ#
`MOVE CAMERA
set camera to follow 1pX#,1pY#+100,1pZ#, 1aY,300,250, 5,1
`TargetX,TargetY,TargetZ, Angle,Distance,Height, Smooth,Collision
`Collision = 1: Automatically adjust camera so as not to pass through static collision boxes
`REFRESH SCREEN
sync
loop
` ***
` *** STOP MAIN SECTION
` ***
` *****************************************
` ***
` *** START END SECTION
` ***
` ***
` *** END SECTION HEADER
` ***
EndSection:
`SCREEN DISPLAY
sync rate 30
cls 0
ink rgb(255,255,255),0
center text 320,220, "GAME OVER"
center text 320,260, "PLAY AGAIN [Y/N]?"
`REFRESH SCREEN
sync
` ***
` *** END SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`CONTROL INPUT
`if Inkey$() = "y" then goto MainSection
`if Inkey$() = "n"
` cls 0
` end
`endif
`REFRESH SCREEN
sync
loop
end
` ***
` *** STOP END SECTION
` ***
` *****************************************
` *****************************************
` ***
` *** START FUNCTIONS
` ***
` ***
` *** MAKE WALL - makeWall
` *** Create a Textured Plain
` ***
function makeWall(objNum, width,height, xAng,yAng,zAng, xPos,yPos,zPos, myWire,myTrans,myCull, myTexture,uScaleT#,vScaleT#, myCollision)
make object plain objNum, width,height
Xrotate object objNum, xAng
Yrotate object objNum, yAng
Zrotate object objNum, zAng
position object objNum, xPos,yPos,zPos
if myCollision = 1
if yAng = 0 or yAng = 180
make static collision box xPos-(width/2),yPos-(height/2),zPos, xPos+(width/2),yPos+(height/2),zPos
endif
if yAng = 90 or yAng = 270
make static collision box xPos,yPos-(height/2),zPos-(width/2), xPos,yPos+(height/2),zPos+(width/2)
endif
endif
set object objNum, myWire,myTrans,myCull
scale object texture objNum,uScaleT#,vScaleT#
endfunction
` ***
` *** CREATE POST - createPost
` *** Create a Wooden Post
` ***
function createPost(objectNum, XPos,YPos,ZPos)
make object box objectNum, 50,500,50
position object objectNum, XPos,YPos,ZPos
set object objectNum, 1,0,0
scale object texture objectNum, .05,1
make static collision box XPos-25,-250,ZPos-25, XPos+25,250,ZPos+25
endfunction
` ***
` *** CLEAR WORLD - ClearWorld
` *** Remove all existing 3D elements from world
` ***
function ClearWorld
for x = 1 to 1000
if object exist(x) = 1 then delete object x
if matrix exist(x) = 1 then delete matrix x
if mesh exist(x) = 1 then delete mesh x
if light exist(x) = 1 then delete light x
if x <= 32
if animation exist(x) = 1 then delete animation x
endif
next x
`Static Objects
make object cube 1,5
make static object 1
delete object 1
delete static objects
fog off
backdrop off
endfunction
` ***
` *** STOP FUNCTIONS
`*****
`***
`*** END PROGRAM
`***
`*****************************************
`*****************************************
Alright what i am trying to do is make a mouseclick on a 3d object.. how would i do that?
Also i am trying to make a popup screen when you click on that object..
Also how would i make questions? so when you answer them right they calculate your score and go to next question (5 questions).
If you could help let me know.. Thanks