o.k., i didn't know you need the whole thing. it's kind of long, so here it is.
`include the MatEdit LoadMatrix files
#include "LoadMatrix.dba"
`#include "voy_intro.dba"
`#include "weather.dba"
`set up the program
sync on
sync rate 0
`remstart
`windows stuff
`set display mode 640,480,16
set window on
set window layout 1,1,1
set window position (screen width()/4),(screen height()/4)
set window title "Exile's Journey"
position mouse (screen width()/4),(screen height()/4)
hide mouse
`remend
`load intro
`voy_intro()
disable escapekey
Rem *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Rem !!!!!! VERY VERY IMPORTANT !!!!!!
Rem Please copy the following DIM statements into your program for the
Rem LoadMatrix call, EVEN IF YOU DON'T USE THEM!
Dim BigMatrix(600,600,1)
Dim StartLoc_X(1): Dim StartLoc_Z(1):Dim Info(2)
Dim TArrayX(1): Dim TArrayZ(1): Dim FKey(10,1)
Dim ColData(100): Dim ZoneData(100): Dim Tiles(500,500)
Dim OverTexture$(100): Dim OverName$(20): Dim ReplaceTex(100)
Dim MOffsetX(25): Dim MOffsetY(25)
Dim MWire(20): Dim MGhost(20): Dim Lock(20)
Dim MatX#(20): Dim MatY#(20): Dim MatZ#(20)
Dim MatWidth#(20): Dim MatHeight#(20)
Dim TilesX(20): Dim TilesZ(20)
Dim MatHi#(20): Dim MatLo#(20)
Rem *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
`loading stuff
load image "SLAB04.jpg",4
load image "loading.bmp",5
sprite 1,0,0,4
stretch sprite 1,250,200
paste sprite 1,0,0
sprite 2,125,100,5
stretch sprite 2,150,150
paste sprite 2,200,150
`load the matrix
LoadMatrix("KELT",1)
`make water
gosub water
`make the magic ball things
gosub orbsOfLife
`trees
gosub trees
`waterfall
gosub waterfall
`houses
gosub houses
`town's outer perimeter
gosub perimeter
`array for bird sounds
DIM birdSound(5)
birdSound(1)=1
birdSound(2)=200
birdSound(3)=500
birdSound(4)=900
birdSound(5)=1500
`array for underwater sounds
DIM waterSound(2)
waterSound(1)=1
waterSound(2)=101
`weather function
`weather(weatherState)
gosub weather
`setup the background
set mipmap mode 1
`backdrop on
`color backdrop RGB(30,60,100)
set camera range 1,2500
`fog on
`fog distance 4570
`fog color RGB(30,60,100)
`light?
`set ambient light 25
`position camera 54215.1,0,58773.4
`position camera 86572.1,0,73094.7 : `where isolated house is
position camera 26624.3,0,46451.6 : `beachfront village
oldX# = camera position x()
oldY# = camera position y()
oldZ# = camera position z()
remstart
`check weather state for sound usage
if weatherState = 0 or weatherState = 1
load sound "owl.wav",5
set sound volume 5,30
load sound "crickets.mp3",2
set sound volume 2,16
loop sound 2
endif
if weatherState = 2 or weatherState = 3
load sound "nigtengale.wav",5
set sound volume 5,30
endif
remend
`load sounds
gosub sounds
`delete loading images
delete sprite 1
delete sprite 2
`-------------------------------------------------------------------
`MAIN LOOP
`-------------------------------------------------------------------
main:
do
fps# = screen fps()
set cursor 0,0
print x#
print y#
print z#
print fps#
`birdsound routine
gosub birdsounds
rem store object angle
CameraAngleY#=Camera Angle Y()
rem mouse control for camera
position mouse 320,240
cx#=wrapvalue(cx#+mousemovey() )
cy#=wrapvalue(cy#+mousemovex() )
cz#=wrapvalue(cz#+mousemovez() )
Rem Rotate camera
if cx#>270
if cx#-270 > 90 then cx#=270
else
if cx# > 90 and cx#-270<270 then cx#=90
endif
rotate camera cx#,cy#,cz#
rem control input for camera
if upkey()=1
`if Y# < 29000
Xtest# = newxvalue(X#,CameraAngleY#,20)
Ztest# = newzvalue(Z#,CameraAngleY#,20)
if X# > 12000 and X# < 88000 and Z# > 12000 and Z# < 88000
move camera 12
if sound playing(1)=0 then play sound 1
endif
`else
if X# < 12000 then X# = 12001
if X# > 88000 then X# = 79999
if Z# < 12000 then Z# = 12001
if Z# > 88000 then Z# = 79999
`X# = oldX#
`Y# = oldY#
`Z# = oldZ#
`if cy# > 179 and cy# < 361 and cx# >0 and cx# < 180
` move camera 12
`endif
`endif
rem running control
if shiftkey()=1
`if Y# < 29000
Xtest# = newxvalue(X#,CameraAngleY#,20)
Ztest# = newzvalue(Z#,CameraAngleY#,20)
if X# > 12000 and X# < 88000 and Z# > 12000 and Z# < 88000
move camera 20
if sound playing(1)=1 then stop sound 1
if sound playing(3)=0 then play sound 3
else
X# = oldX#
Y# = oldY#
Z# = oldZ#
`if cy# > 179 and cy# < 361 and cx# >0 and cx# < 180
`move camera 25
` endif
endif
endif
endif
if downkey()=1
if Y# < 29000
Xtest# = newxvalue(X#,wrapvalue(CameraAngleY#),20)
Ztest# = newzvalue(Z#,wrapvalue(CameraAngleY#),20)
move camera -6
if sound playing(1)=0 then play sound 1
else
X# = oldX#
Y# = oldY#
Z# = oldZ#
if cy# > 179 and cy# < 361 and cx# >0 and cx# < 180
move camera -6
endif
endif
endif
if X# < 12000 then X# = 12001
if X# > 88000 then X# = 79999
if Z# < 12000 then Z# = 12001
if Z# > 88000 then Z# = 79999
X# = Camera Position X()
Z# = Camera Position Z()
Y# = get ground height(1,X#,Z#)
`for the underwater stuff
if Y# < -548.35
fog distance 2500
pause sound 1
if sound exist(2)=1
if sound playing(2)=1 then pause sound 2
endif
pause sound 3
pause sound 4
pause sound 5
pause sound 8
pause sound 100
pause sound 101
pause sound 102
RANDOMIZE TIMER()
waterSound = RND(350)
if waterSound = 1 then play sound 6
if waterSound = 101 then play sound 6
else
fog distance 4060
stop sound 6
if weatherState = 1 or weatherState = 3
resume sound 2
endif
resume sound 1
if sound exist(2)=1 then resume sound 2
resume sound 3
resume sound 4
resume sound 5
resume sound 8
resume sound 100
resume sound 101
resume sound 102
endif
position camera X#,Y#+120,Z#
position listener X#,Y#+120,Z#
rotate listener X#,Y#+120,Z#
`hit the orbs?
`underwater
if Y# < -17551.8 and Y# > -17625 and X# > 35939.8 and X# < 35998.6 and Z# < 31976 and Z# > 31947.8
if object exist(1) = 1
play sound 7
hide object 1
delete object 1
endif
`until object collision is set up, every time these coordinates are found the sound will play
endif
`in tree grove by lake
if X# < 17183.3 and X# > 17139.1 and Z# < 12683.9 and Z# > 12631.8
if object exist(2) = 1
play sound 7
hide object 2
delete object 2
endif
endif
if X# < 17164.1 and X# > 17135.4 and Z# < 13049.5 and Z# > 13009.7
if object exist(3)
play sound 7
hide object 3
delete object 3
endif
endif
`on precipace
if X# < 49463.5 and X# > 49432.1 and Y# < 3030.93 and Y# > 3029.25 and Z# < 50114.6 and Z# > 50091.5
if object exist(4)
play sound 7
hide object 4
delete object 4
endif
endif
if X# < 48535 and X# > 48529.9 and Y# < 3227.41 and Y# > 3225.21 and Z# < 49810.5 and Z# > 49790.5
if object exist(5)
play sound 7
hide object 5
delete object 5
endif
endif
if object exist(15000) = 1
set object to camera orientation 15000
endif
`trying to make water wavy
`randomize matrix 10000,25
`set object to camera orientation 15000
if escapekey() = 1 then gosub leave
rem numerical acsending screenshot export code
if inkey$()="s"
center text screen width()/2,screen height()/2, "Saving screen shot..."
i=i+1 : save bitmap "screenshot_"+str$(i)+".bmp"
wait 2500
center text screen width()/2,screen height()/2, ""
endif
`update the screen
sync
loop
`--------------------------------------------------------------------------------
`END OF LOOP
`--------------------------------------------------------------------------------
`------------
`SUBROUTINES
`------------
`sounds subroutine +++++++++++++++
sounds:
load sound "Earth slow.mp3",1
load sound "Earth fast.mp3",3
load sound "powerup.mp3",4
load sound "underwater.mp3",6
load sound "powerup.mp3",7
load 3Dsound "waterfall_light.mp3",8
load 3Dsound "underwater bubbles.mp3",9
set sound volume 1,57
set sound volume 3,59
set sound volume 4,55
set sound volume 6,65
set sound volume 7,70
set sound volume 8,100
set sound volume 9,90
`for the waterfall
clone sound 100,8
clone sound 101,8
clone sound 102,8
position sound 8,24345,-22,12020
position sound 100,24329,-432,12410
position sound 101,24994,-401,12370
position sound 102,24987,-70,12064
loop sound 8 : loop sound 101
loop sound 100 : loop sound 102
position sound 9,24624.7,-556.5,12513.5
loop sound 9
RETURN
`end sounds subroutine +++++++++++
`water subroutine ++++++++
water:
load image "water.jpg",1
make matrix 10000,100000,100000,35,35
prepare matrix texture 10000,1,2,2
set matrix texture 10000,1,1
ghost matrix on 10000
position matrix 10000,0,-400,0
RETURN
`orbs of life subroutine ++++++++++
orbsOfLife:
load image "lava.jpg",2
`make orbs of life
for s = 1 to 5
make object sphere s,55
texture object s,2
ghost object on s
fade object s,225
next s
`under water
position object 1,35948,-17496,31956
`in grove of trees
position object 2,17164,-10,12658
position object 3,17144.2,-31,13035.5
`on precipice
position object 4,49454.6,3055.35,50100.5
position object 5,48530.5,3254.24,49803.1
RETURN
`end orbs of life subroutine +++++++
`trees +++++++++++++++
trees:
for t = 200 to 241
load object "newbulbtree.x",t
yrotate object t,270
scale object t,7200,8200,7200
`this is for performance increase, if it doesn't do well, delete second value
`if redone in DBPro, don't use this command
make static object t,1
next t
position object 200,55215,-1,58773 : position object 230,17829.5,-20,12362.4
position object 201,55189,233,55598 : position object 231,16413.8,-23,12480.5
position object 202,27463,-1,45005 : position object 232,16942.9,-52,15826.6
position object 203,654345,399,60622 : position object 233,49074.5,2988.04,50782
position object 204,69459,-1,54713 : position object 234,85100.2,303.807,71125.6
position object 205,77345,870,53278 : position object 235,87055.5,-1,73613.5
position object 206,23602,-1,48479 : position object 236,85230.6,-1,73162.7
position object 207,15544,251,42649 : position object 237,85720.8,428.893,74599.3
position object 208,22747,-1,50577 : position object 238,86018.6,787.819,69680.3
position object 209,24438,-1,49859 : position object 239,87008.3,399.358,70797.6
position object 210,27250,-1,50355 : position object 240,85598.9,12.5845,71961
position object 211,2857,-1,47988 : position object 241,22052.4,-1,51669.9
position object 212,23672,-1,45072
position object 213,60310,-1,57065
position object 214,59352,-1,58469
position object 215,57847,-1,63590
position object 216,56321,-1,65691
position object 217,55469,189,68409
position object 218,53962,724,69567
position object 219,51753,-1,68581
position object 220,50339,-1,66613
position object 221,53419,-1,64688
position object 222,57438,-1,62508
position object 223,18611.5,-28,12502.8
position object 224,18282,-48,12875
position object 225,18019.5,-76,13377.9
position object 226,17678.6,-92,14386.7
position object 227,16335.3,-19,15623.3
position object 228,17659.3,-91,15636.2
position object 229,18979.4,-163,15000.9
RETURN
`end trees subroutine +++++++++++++
`bird sound subroutine +++++++++++
birdsounds:
`randomly pick number for bird
`to seed the random number generator
RANDOMIZE TIMER()
set sound volume 5,30
birdSound = RND(6500)
if birdSound = 1
set sound pan 5,-1000
play sound 5
endif
if birdSound = 200
set sound pan 5,700
play sound 5
endif
if birdSound = 500
set sound pan 5,1000
play sound 5
endif
if birdSound = 900
set sound pan 5,-700
play sound 5
endif
if birdSound = 1500
set sound pan 5,-900
play sound 5
endif
RETURN
`end bird subroutine +++++++++++
`waterfall subroutine
waterfall:
make object plain 401,150,200
scale object 401,450,3000,450
xrotate object 401,171.8
texture object 401,1
scroll object texture 401,0,25
ghost object on 401
position object 401,24658.9,2955,11580.2
make object plain 402,150,200
scale object 402,450,500,450
xrotate object 402,137
texture object 402,1
scroll object texture 402,0,25
ghost object on 402
position object 402,24658.4,-162.2545,12154.4
RETURN
`houses subroutine
houses:
`isolated house in mountains
load object "brickhouse.x",700
position object 700,86572.1,0,73094.7
scale object 700,7200,7200,7200
yrotate object 700,90
`beach village
load object "brickhouse2.x",701
position object 701,25770.3,0,48052.2
scale object 701,7300,7300,7300
load object "brickhouse.x",702
position object 702,25069.1,0,45830.8
scale object 702,7400,7400,7400
load object "brickhouse3.x",703
position object 703,22598.1,0,49158.7
scale object 703,7200,7200,7200
yrotate object 703,90
load object "brickhouse.x",704
position object 704,23451.2,0,49525.5
scale object 704,7300,7300,7300
yrotate object 704,45
load object "brickhouse2.x",705
position object 705,21421.9,0,44637.9
scale object 705,7400,7400,7400
yrotate object 705,90
load object "brickhouse3.x",706
position object 706,20591.7,0,47318.7
scale object 706,7200,7200,7200
yrotate object 706,45
load object "brickhouse.x",707
position object 707,29638.8,0,49960.1
scale object 707,7300,7300,7300
load object "brickhouse2.x",708
position object 708,28058.4,0,46851
scale object 708,7200,7200,7200
load object "bighouse.x",709
position object 709,23234.3,0,47004.1
scale object 709,7500,7500,7500
load object "housedeck.x",710
position object 710,26542.3,0,44689
scale object 710,7200,7200,7200
RETURN
`just for the hell of it
for h = 700 to 710
disable object zdepth h
next h
`town's outer perimeter
perimeter:
for w = 900 to 903
load object "wall.x",w
scale object w,19000,10000,9000
next w
position object 900,23154.7,-38,52024.5 : position object 903,30768.9,-38,52024.5
position object 901,25737,-38,52024.5
position object 902,28189.9,-38,52024.5
load object "fence.x",907
scale object 907,9500,9500,9500
position object 907,21823.4,0,51750.2
return
`weather------------------------------------------------------
weather:
randomize timer()
weatherState = RND(3)
`for late dusk
if weatherState = 0 or weatherState = 1
backdrop on : `color backdrop RGB(30,60,100)
load image "star_field.jpg",150 : `texture backdrop 1
`backdrop off
make object sphere 15000,900
texture object 15000,150
`scale object 15000,100,100,100
`fade object 15000,100
set object 15000,1,1,0,1,0,0,0
set object to camera orientation 15000
fog on : fog color RGB(30,60,60)
set ambient light 25
load sound "owl.wav",5 : set sound volume 5,30
load sound "crickets.mp3",2 : set sound volume 2,16 : loop sound 2
endif
`for foggy day
if weatherState = 2 or weatherState = 3
backdrop on : color backdrop RGB(128,128,128)
fog on : fog color RGB(128,128,128)
set ambient light 88
load sound "nightengale.wav",5 : set sound volume 5,30
endif
return
` exiting sequence ++++++++++++
leave:
do
center text screen width()/2, screen height()/2,"Do you wish to exit (y/n)?"
`if a "y" is entered
if keystate(21) = 1
`delete sounds
for mp3 = 1 to 8
delete sound mp3
next mp3
`delete trees
for tr = 200 to 241
delete object tr
next tr
`delete orbs of life
for oof = 1 to 5
if object exist(oof) = 1
delete object oof
endif
next oof
`delete waterfall
for wf = 401 to 402
delete object wf
next wf
`delete houses
for h = 700 to 710
delete object h
next h
`delete water matrix
delete matrix 10000
`delete main matrix
delete matrix 1
`delete texture images
for i = 1 to 6
delete image i
next i
`delete arrays
UNDIM birdSound(5) :UNDIM MOffsetX(25)
UNDIM waterSound(2) :UNDIM MOffsetY(25)
UNDIM BigMatrix(600,600,1) :UNDIM MWire(20)
UNDIM StartLoc_X(1) :UNDIM MGhost(20)
UNDIM StartLoc_Z(1) :UNDIM Lock(20)
UNDIM Info(2) :UNDIM MatX#(20)
UNDIM TArrayX(1) :UNDIM MatY#(20)
UNDIM TArrayZ(1) :UNDIM MatZ#(20)
UNDIM FKey(10,1) :UNDIM MatWidth#(20)
UNDIM ColData(100) :UNDIM MatHeight#(20)
UNDIM ZoneData(100) :UNDIM TilesX(20)
UNDIM Tiles(500,500) :UNDIM TilesZ(20)
UNDIM OverTexture$(100) :UNDIM MatHi#(20)
UNDIM OverName$(20) :UNDIM MatLo#(20)
UNDIM ReplaceTex(100)
`now leave program
end
endif
`if a "n" was entered
if keystate(49) = 1
exit
endif
sync
loop
RETURN
`end of exiting subroutine ++++++++++++++++++++++
i know it's rather sloppy, i'm still very new at this stuff. i'll try and comment out the object orientation command to see what it does. thanx a bunch, rich!
You're ate up like a soup sandwich.