` ***
` *** START SYSTEM SETUP SECTION
` ***
sync on
sync rate 30
autocam on
hide mouse
randomize timer()
` ***
` *** STOP SYSTEM SETUP SECTION
` ***
` ***************************************
` ***
` *** START INTRO SECTION
` ***
` ***
` *** INTRO SECTION HEADER
` ***
`DECLARE VARIABLES
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
load bitmap \"images\\bmp\\intro screen.bmp\"
`LOAD SOUNDS
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** INTRO SECTION LOOP
` ***
do
`SCREEN DISPLAY
`CONTROL INPUT
if keystate( scancode() ) = 1 then goto OptionsSection
`REFRESH SCREEN
sync
loop
` ***
` *** END INTRO SECTION
` ***
` *****************************************
` ***
` *** START OPTIONS SECTION
` ***
` ***
` *** OPTIONS SECTION HEADER
` ***
OptionsSection:
`DECLARE VARIABLES
`Levels
TotalLevels = 1 : `Total number of levels
LevelNumber = 1 : `Start on Level 1
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
center text 320,220,\"SET YOUR OPTIONS HERE\"
center text 320,260,\"HIT ANY KEY TO BEGIN\"
`LOAD SOUNDS
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** OPTIONS SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`SCREEN DISPLAY
`CONTROL INPUT
if Keystate(scancode())=1 then goto LevelIntroSection
`REFRESH SCREEN
sync
loop
` ***
` *** END OPTIONS SECTION
` ***
` *****************************************
` ***
` *** START LEVEL INTRO SECTION
` ***
` ***
` *** LEVEL INTRO SECTION HEADER
` ***
LevelIntroSection:
`DECLARE VARIABLES
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
center text 320,220, \"LEVEL\"
set cursor 320,240
print LevelNumber
center text 320,260, \"HIT ANY KEY TO BEGIN\"
`LOAD SOUNDS
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** LEVEL INTRO SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`SCREEN DISPLAY
`CONTROL INPUT
if keystate( scancode() ) = 1 then goto MainSection
`REFRESH SCREEN
sync
loop
` ***
` *** END LEVEL INTRO SECTION
` ***
` *****************************************
` ***
` *** START MAIN SECTION
` ***
` ***
` *** MAIN SECTION HEADER
` ***
MainSection:
`DECLARE VARIABLES
`Player Character
`Projectiles
`Enemies
`Other
`LOAD IMAGES
load image \"images\\bmp\\wood floor.bmp\",2
load image \"images\\bmp\\wall.bmp\",1
`SCREEN DISPLAY
cls 0
backdrop on
`TEXT
`HEADS-UP DISPLAY (HUD)
`OBJECT CREATION
`World Map
rem North Wall
make object box 2,2000,1000,10
scale object 2,100,100,100
rotate object 2,0,0,0
position object 2, 0,0,1005
texture object 2,1
rem East Wall
make object box 3,2000,1000,10
scale object 3,100,100,100
rotate object 3,0,90,0
position object 3, 1005,0,0
texture object 3,1
rem South Wall
make object box 4,2000,1000,10
scale object 4,100,100,100
rotate object 4,0,180,0
position object 4, 0,0,-1005
texture object 4,1
rem West Wall
make object box 5,2000,1000,10
scale object 5,100,100,100
rotate object 5,0,270,0
position object 5,-1005,0,0
texture object 5,1
rem Floor
make object box 6,2000,2000,10
scale object 6,100,100,100
rotate object 6,90,0,0
position object 6,0,-500,0
texture object 6,2
`Player Character
make object cylinder 1,50
scale object 1,100,140,100
make object collision box 1,-25,-35,-25,25,35,25,0
position object 1,0,-440,0
`Enemies
`Pick-Ups
`LOAD MODELS
`SET LIGHTS
cpX# = camera position X()
cpY# = camera position Y()
cpZ# = camera position Z()
caX# = camera angle X()
caY# = camera angle Y()
caZ# = camera angle Z()
`SET CAMERA
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** MAIN SECTION LOOP
` ***
do
`SPECIAL EFFECTS
`OBJECT ORIENTATIONS (Pre-Movement, Pre-Collision)
`Player Character
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)
`Projectiles
`Enemies
`COLLISION
if 1pX# < -975 then 1pX# = -975
if 1pZ# < -975 then 1pZ# = -975
`LIVE SCREEN DISPLAY
`TEXT
center text 320,440,\"USE ARROW KEYS TO MOVE | PRESS \'Q\' TO QUIT\"
`HUD
`CONTROL INPUT
`Acceleration and Pitch
if inkey$()= \"w\" then move object 1,10
if inkey$()= \"s\" then move object 1,-10
`Turning and Banking
cy#=wrapvalue(cy#+mousemovex())
Yrotate object 1,cy#
`Releasing Projectiles
`Quit Game
if Inkey$() = \"q\"
ClearWorld()
goto EndSection
endif
`VARIABLES
`TRANSFORM OBJECTS
`MOVE OBJECTS
`Player Character
`Projectiles
`Enemies
`OBJECT ORIENTATIONS (Post-Movement, Pre-Collision)
`Player Character
`Projectiles
`Enemies
`CHECK COLLISIONS
`Player Character
set object collision on 1
`Walls
make object collision box 2, -1000,-1000,-5, 1000,1000,5, 1
set object collision on 2
make object collision box 3, -1000,-1000,-5, 1000,1000,5, 1
set object collision on 3
make object collision box 4, -1000,-1000,-5, 1000,1000,5, 1
set object collision on 4
make object collision box 5, -1000,-1000,-5, 1000,1000,5, 1
set object collision on 5
make object collision box 6, -1000,-5,-1000, 1000,5,1000, 1
set object collision on 6
`Pick-Ups
`Enemies
`Projectiles
`Walls
`Enemies
`Enemies
`Walls
`OBJECT ORIENTATIONS (Post-Movement, Post-Collision)
`Player Character
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)
`Projectiles
`Enemies
`CHECK PLAYER EXPIRATION
`MOVE CAMERA
cpZ# = Newzvalue(1pZ#,1aY-180,200) : Rem Calculate the camera\'s new Z position
cpX# = Newxvalue(1pX#,1aY-180,200) : Rem Calculate the camera\'s new X position
Position camera cpX#,-350,cpZ# : Rem Set the camera placement
Point camera 1pX#,1pY#+50,1pZ# : Rem Point camera at the top of Object 1
`cx#=wrapvalue(cx#+mousemovey())
`rotate camera cx#,0,0
set cursor 0,0
print \"Camera Data\"
print \"-----------\"
print \"camera pos x=\";camera position x()
print \"camera pos y=\";camera position y()
print \"camera pos z=\";camera position z()
print \"camera rot x=\";camera angle x()
print \"camera rot y=\";camera angle y()
print \"camera rot z=\";camera angle z()
print 1pX#
print 1pY#
print 1pZ#
sync
loop
` ***
` *** STOP MAIN SECTION
` ***
` *****************************************
` ***
` *** START END SECTION
` ***
` ***
` *** END SECTION HEADER
` ***
EndSection:
`DECLARE VARIABLES
`SCREEN DISPLAY
cls 0
ink rgb(255,255,255),0
center text 320,220, \"GAME OVER\"
center text 320,260, \"PLAY AGAIN [Y/N]?\"
`SOUND EFFECTS
`SPECIAL EFFECTS
`REFRESH SCREEN
sync
` ***
` *** END SECTION LOOP
` ***
do
if scancode() = 0 then exit
loop
do
`CONTROL INPUT
if Inkey$() = \"y\" then goto OptionsSection
if Inkey$() = \"n\"
cls 0
end
endif
`REFRESH SCREEN
sync
loop
end
` ***
` *** STOP END SECTION
` ***
` *****************************************
` *****************************************
` ***
` *** START FUNCTIONS
` ***
` ***
` *** 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
cls 0
endfunction
` ***
` *** STOP FUNCTIONS
` ***
`***
`*** END PROGRAM
`***
`*****************************************
`*****************************************
Why do I go through walls? Please help.
I tried two different collision methods and both failed :/