Ah yes - forgot to say, uses the createsound() function which needs version 5.8. You could delete the createsound() function, and then use the error message reports to weed out the few sound commands that won't then work.
Thanks for the comments Rii - I was working on the nav-system when I ran out of steam, hence the reason it didn't work properly.
<Update>
`Rpg challenge by Ric
`display settings
if check display mode(1024,768,32)=1 then set display mode 1024,768,32
sync on
sync rate 30
hide mouse
global name$
titles()
`camera and light settings
autocam off
set camera range 0.01,10000
color backdrop 0
hide light 0
set ambient light 20
make light 1
`creat sounds
createsound("wave",1,6200,10000,2000,30,0.01,10,5,0,0,0.05)
createsound("foot steps",2,200,20,8000,.1,4.0,2.1,10,9.2,9.2,10)
createsound("ding",3,800,1000,6000,0,0.2,0.1,.5,1.2,0.2,10)
createsound("vibrato1",4,500,8000,8000,-0.0001,0.03,0.1,0.4,0,0,.1)
createsound("vibrato2",5,400,8000,8000,-0.0002,0.03,0.1,0.4,0,0,.1)
createsound("vibrato3",6,600,8000,8000,-0.0003,0.03,0.1,0.4,0,0,.1)
`set the randomize seed to the timer, so random events are different each time
randomize timer()
`set size of terrain
global matrixsize
matrixsize=100
`fog settings
fog on
fog color rgb(180,180,250)
fog distance matrixsize*0.6
`set initial value for object numbers
global object_seed
object_seed=1000000
`set initial value for image numbers
global image_seed
image_seed=1000000
create bitmap 1,screen width(),screen height()
set current bitmap 1
`function calls for creating world
global wallpaper
global light
make_wallpaper()
global internaldoor
global dim table(2000000)
global dim collisiondummy(2000000)
global room
make_room()
`position light for world illumination
position light 1,200,100,200
set light range 1,100000
global grassimage
create_grass()
global doortexture
make_door_texture()
global housetexture
make_house_texture()
global skyimage
create_sky()
global waterimage
global water
global water2
global theta#
create_water_image()
create_water()
global terrainimage
terraform()
global sphere1
global sphere2
global sphere3
create_skysphere()
`set house variables
global inroom
global numberofhouseentered
global number_of_houses
number_of_houses=rnd(20)+5
`set up an array to store house numbers
global dim house(number_of_houses)
global dim door(number_of_houses)
`make houses with numbers from 1 to max number of houses
for house_number=1 to number_of_houses
make_house(house_number)
next house_number
global internaltowerdoor
global tower
global towerdoor
global key
global keyshaft
global navigator
make_tower()
make_tower_room()
`make dummy for camera to follow
make object cube 1,0.01
hide object 1
make object collision box 1,-0.05,-0.05,-0.05,0.05,0.05,0.05,0
global collision
global flying
global introover
global footsteptimer
global info
global unlocked
global blob
ink 0,0
set text size 20
set current bitmap 0
`set initial player position
position object 1,matrixsize/2,get ground height(1,50,50)+2,matrixsize/2
`set initial camera position before intro
position camera object position x(1),1.5,-100
global map
global pointer
setup_navigator()
gosub beginning
loop sound 1
`****************************************
`main program loop
do
if returnkey()=1 then flying=1
`message subroutines
gosub display_message
`function calls for continuous events
if introover=0 then intro()
if introover=1 then move_camera()
if introover=1 then collision()
move_water()
if gotnavigator=1 then navigate()
`text 0,0,str$(screen fps())
`text 0,20,"house number: "+str$(numberofhouseentered)
`text 0,500,str$(table(tower))
sync
loop
`****************************************
`functions
function terraform
`set size of terrain
rows=60
columns=60
`create terrain
make matrix 1,matrixsize,matrixsize,columns,rows
`set mountain peaks
number_of_peaks=rnd(35)+10
max_height=15
dim peakx(number_of_peaks)
dim peakz(number_of_peaks)
dim height(number_of_peaks)
for peak=1 to number_of_peaks
`set x,z coordinates for peak
peakx(peak)=rnd(columns-10)+5
peakz(peak)=rnd(rows-10)+5
`set height of peak
height(peak)=rnd(max_height)+10
`create peak
set matrix height 1,peakx(peak),peakz(peak),height(peak)
next peak
num=rows*columns
dim obnum(rows+1,columns+1)
dim v#(rows,columns)
`give each tile an x,z coordinate for use later
for x=1 to rows
for z=1 to columns
obnum(x,z)=ob
ob=ob+1
next z
next x
`texture matrix
prepare matrix texture 1,grassimage,rows,columns
tile=1
for x=rows-1 to 0 step -1
for z=0 to columns-1
set matrix tile 1,z,x,tile
inc tile
next z
next x
`adjust height of points between peaks
elasticity#=0.3
damping#=0
for time=1 to 100
for peak=1 to number_of_peaks
set matrix height 1,peakx(peak),peakz(peak),height(peak)
next peak
for x=1+1 to rows-1
for z=1+1 to columns-1
if x<rows
distxp1#=get matrix height(1,x+1,z)-get matrix height (1,x,z)
endif
if x>1
distxm1#=get matrix height(1,x-1,z)-get matrix height (1,x,z)
endif
if z<columns
distzp1#=get matrix height(1,x,z+1)-get matrix height (1,x,z)
endif
if z>1
distzm1#=get matrix height(1,x,z-1)-get matrix height (1,x,z)
endif
vectorsum#=distxp1#+distxm1#+distzp1#+distzm1#
a#=vectorsum#*elasticity#
v#(obnum(x,z))=v#(obnum(x,z))+a#
set matrix height 1,x,z,get matrix height(1,x,z)+v#(obnum(x,z))
v#(obnum(x,z))=v#(obnum(x,z))*damping#
next z
next x
update matrix 1
next time
endfunction
function check_free_object_number
`this handy function means that you never have to worry about
`remembering object numbers. You just give them names you can remember,
`and this function will find the next available number to assosciate
`with that name. Just call the function by, for example, writing:
`
`ball=check_free_object_number
`make object sphere ball,1
object=object_seed
repeat
inc object
until object exist(object)=0
endfunction object
function check_free_image_number()
`this functionworks in the same way as the check_free_object function,
`except it works for images.
image=image_seed
repeat
inc image
until image exist(image)=0
endfunction image
function create_grass
`make a shaded box
box 0,0,100,100,rgb(100,150,100),rgb(50,200,20),rgb(80,0,10),rgb(150,200,0)
`and speckle it with random dots
for x=0 to 100
for y=0 to 100
if rnd(5)=0
r=rnd(150)
g=rnd(250)
b=rnd(100)
ink rgb(r,g,b),0
dot x,y
endif
next x
next y
grassimage=check_free_image_number()
get image grassimage,0,0,100,100
endfunction
function create_skysphere
`get image for sphere by taking snapshot of terrain
terrainimage=check_free_image_number()
set camera fov 90
position camera matrixsize/2.0,3,-matrixsize*0.3
sync
get image terrainimage,0,0,screen width(),screen height()
set camera fov 60
`sphere 1 (mountains near) - just a sphere textured with the captured image
sphere1=check_free_object_number()
make object sphere sphere1,matrixsize*4
set object collision off sphere1
set object cull sphere1,0
texture object sphere1,terrainimage
set object texture sphere1,2,1
scale object texture sphere1,3,1
set object fog sphere1,0
set object light sphere1,0
set object transparency sphere1,4
position object sphere1,matrixsize/2,0,matrixsize/2
`sphere 2 (mountains far) - and another one further out. The inner sphere must be
`transparent, though, to see this one.
sphere2=check_free_object_number()
make object sphere sphere2,matrixsize*5
set object collision off sphere2
yrotate object sphere2,30
set object cull sphere2,0
texture object sphere2,terrainimage
set object texture sphere2,2,1
scale object texture sphere2,3,1
set object fog sphere2,0
set object transparency sphere2,4
ghost object on sphere2,4
set object emissive sphere2,rgb(180,150,250)
fade object sphere2,70
position object sphere2,matrixsize/2,0,matrixsize/2
`sphere 3 (sky) - a third, outer sphere for the sky
sphere3=check_free_object_number()
make object sphere sphere3,matrixsize*6
set object collision off sphere3
set object cull sphere3,0
texture object sphere3,skyimage
scale object texture sphere3,1,1.8
set object light sphere3,0
set object fog sphere3,0
position object sphere3,matrixsize/2,0,matrixsize/2
endfunction
function create_sky()
`creates a dark to light bluish gradient
cls
for n=0 to 250
ink rgb(n,n,250),0
line 0,n,250,n
next n
skyimage=check_free_image_number()
get image skyimage,0,0,250,250
endfunction
function create_water_image
`creates a shaded box
box 0,0,100,100,rgb(150,150,200),rgb(50,200,200),rgb(80,0,200),rgb(150,100,200)
`and speckles with white bits
for x=0 to 100
for y=0 to 100
if rnd(5)=0
r=(250)
g=(250)
b=(250)
ink rgb(r,g,b),0
dot x,y
endif
next x
next y
waterimage=check_free_image_number()
get image waterimage,0,0,100,100
endfunction
function create_water
`just 2 planes textured with the water image
`top layer
water=check_free_object_number()
make object plain water,matrixsize*8,matrixsize*8
set object collision off water
texture object water,waterimage
set object texture water,2,1
scale object texture water,8,8
xrotate object water,90
set object fog water,0
set object emissive water,rgb(220,220,200)
ghost object on water
set alpha mapping on water,20
`bottom layer
water2=check_free_object_number()
make object plain water2,matrixsize*8,matrixsize*8
set object collision off water2
texture object water2,waterimage
xrotate object water2,90
position object water2,0,1,0
set object texture water2,2,1
scale object texture water2,8,8
set object light water2,0
set object fog water2,0
endfunction
function move_water
`moves the texture along a bit
scroll object texture water,0.001,0
scroll object texture water2,-0.001,0
`and moves the water up and down according to a sine wave
position object water,0,0.5*sin(theta#)+3,0
inc theta#,1
`adjust wave volume according to height above water
volume#=600/(object position y(1)+1)
if volume#>100 then volume#=100
if volume#<80 then volume#=80
set sound volume 1,volume#
endfunction
function move_camera
walkmode=1
if shiftkey()=1 then walkmode=2
speed#=0
if upkey()=1 then speed#=0.05*walkmode
if downkey()=1 then speed#=-0.05
if rightkey()=1 then yrotate object 1,object angle y(1)+2
if leftkey()=1 then yrotate object 1,object angle y(1)-2
if inkey$()="a" then position object 1,object position x(1),object position y(1)+0.1,object position z(1)
if inkey$()="z" then position object 1,object position x(1),object position y(1)-0.11,object position z(1)
`reposition dummy object
position object 1,object position x(1)+speed#*sin(object angle y(1)),object position y(1),object position z(1)+speed#*cos(object angle y(1))
`set camera to dummy object's position and orientation
position camera object position x(1),object position y(1),object position z(1)
yrotate camera object angle y(1)
`play footstep sound
if object position y(1)>object position y(water)+0.4
if speed#<>0 and footsteptimer=0 then play sound 2
inc footsteptimer
if footsteptimer>20/walkmode then footsteptimer=0
endif
endfunction
function make_house(house)
`give each house a numbered variable ( eg. house(1),house(2), etc,)
` and store the actual object number in that variable
house(house)=check_free_object_number()
make object box house(house),2,2,1
set object collision on house(house)
set object cull house(house),0
texture object house(house),housetexture
scale object texture house(house),20,40
roof=check_free_object_number()
make object box roof,1.98,1,1
color object roof,rgb(80,80,80)
position object roof,0,1,0
xrotate object roof,45
glue object to limb roof,house(house),0
door(house)=check_free_object_number()
make object box door(house),0.2,0.4,0.02
texture object door(house),doortexture
position object door(house),0,0,0
glue object to limb door(house),house(house),0
repeat
x=rnd(matrixsize)
z=rnd(matrixsize)
position object house(house),x,get ground height(1,x,z),z
until object position y (house(house))>3
`glue object to limb door(house),house(house),0
yrotate object house(house),rnd(360)
position object door(house),object position x(door(house)),get ground height(1,object position x(house(house))-0.5*sin(object angle y(house(house))),object position z(house(house))-0.5*cos(object angle y(house(house))))+0.2-object position y(house(house)),object position z(door(house))
position object door(house),object position x(door(house)),object position y(door(house)),object position z(door(house))-0.492
endfunction
function make_house_texture
cls
ink rgb(200,200,180),0
box 0,0,5,15
ink rgb(100,60,40),0
box 0,0,4,14
housetexture=check_free_image_number()
get image housetexture,0,0,5,15
endfunction
function make_door_texture
cls
colour=rgb(rnd(250),rnd(250),rnd(250))
ink colour,0
box 0,0,8,8
ink 0,0
box 1,1,3,3
box 5,1,7,3
ink colour-100,0
box 1,4,7,7
doortexture=check_free_image_number()
get image doortexture,0,0,8,8,1
endfunction
function make_wallpaper
cls
ink rgb(185,205,255),0
box 0,0,100,100
for x=0 to 100
for y=0 to 100
if rnd(5)=0
ink rgb(rnd(200),rnd(200),rnd(200)),0
dot x,y
endif
next y
next x
wallpaper=check_free_image_number()
get image wallpaper,0,0,100,100
endfunction
function make_room
wall1=check_free_object_number()
make object box wall1,20,10,0.1
position object wall1,0,1004.8,-5
texture object wall1,wallpaper
scale object texture wall1,10,10
wall2=check_free_object_number()
make object box wall2,20,10,0.1
position object wall2,0,1004.8,5
texture object wall2,wallpaper
scale object texture wall2,10,10
wall3=check_free_object_number()
make object box wall3,10,10,0.1
yrotate object wall3,90
position object wall3,-10,1004.8,0
texture object wall3,wallpaper
scale object texture wall3,10,10
wall4=check_free_object_number()
make object box wall4,10,10,0.1
yrotate object wall4,90
position object wall4,10,1004.8,0
texture object wall4,wallpaper
scale object texture wall4,10,10
floor=check_free_object_number()
make object box floor,20,10,0.1
xrotate object floor,90
position object floor,0,999.8,0
color object floor,rgb(200,10,20)
ceiling=check_free_object_number()
make object box ceiling,20,10,0.1
xrotate object ceiling,90
position object ceiling,0,1006,0
make light 2
position light 2,9,1004,4
set light range 2,15
lamp=check_free_object_number()
make object plain lamp,0.5,0.5
position object lamp,8.4,1004,3.4
yrotate object lamp,45
texture object lamp,light_image()
set object transparency lamp,5
lampshade=check_free_object_number()
make object cone lampshade,1
position object lampshade,8.4,1004,3.4
ghost object on lampshade,3
lampwire=check_free_object_number()
make object plain lampwire,0.02,4
yrotate object lampwire,45
position object lampwire,8.41,1006,3.41
make_table(room)
position object table(room),7,1002,3
entity=check_free_object_number()
make object cube entity,0.5
color object entity,rgb(0,250,50)
position object entity,7,1002.3,3
internaldoor=check_free_object_number()
make object plain internaldoor,2,4
position object internaldoor,0,1001.8,-4.89
color object internaldoor,rgb(220,20,50)
endfunction
function enter_house(number)
if unlocked=1
inroom=1
show light 2
hide light 1
hide light 3
position object 1,0,1003,-4
point object 1,0,1003,5
else
play sound 3
ink rgb(0,255,0),0
text 0,20,"Door is locked"
sync
wait 1000
ink 0,0
endif
endfunction
function exit_house()
position object 1,object position x(house(numberofhouseentered)),object position y(1),object position z(house(numberofhouseentered))
set object to object orientation 1,house(numberofhouseentered)
move object 1,-1
yrotate object 1,180
show light 1
inroom=0
endfunction
function light_image()
ink rgb(255,255,0),0
box 0,0,1,1
image=check_free_image_number()
get image image,0,0,1,1
cls
sphere1=check_free_object_number()
make object sphere sphere1,1,30,30
ghost object on sphere1
set object specular power sphere1,50
set object specular sphere1,rgb(200,200,200)
position light 1,0,-1,2
position object sphere1,0,0,3
texture object sphere1,image
a=int(screen width()/3.0)
b=int(screen height()/3.0)
c=int(screen width()*2/3.0)
d=int(screen height()*2/3.0)
sphere2=check_free_object_number()
make object sphere sphere2,0.3
position object sphere2,0,-0.2,3
ghost object on sphere2
sync
light=check_free_image_number()
get image light,a,b,c,d
delete object sphere1
delete object sphere2
endfunction light
function collision
collision=object collision(1,0)
`check collision with external doors
for number=1 to number_of_houses
if collision=door(number)
enter_house(number)
numberofhouseentered=number
endif
next number
if collision=collisiondummy(room) then info=3
if collision=towerdoor then enter_tower()
`check collision with internal door
if collision=internaldoor then exit_house()
if collision=internaltowerdoor then exit_tower()
`apply sliding collision
if collision>1
position object 1,object position x(1)-get object collision x(),object position y(1),object position z(1)-get object collision z()
endif
if collision=collisiondummy(tower)
hide object key
hide object keyshaft
hide object navigator
info=2
endif
`set dummy position to ground level
if inroom=0 and flying=0
position object 1,object position x(1),get ground height(1,object position x(1),object position z(1))+0.2,object position z(1)
endif
`if in water, set dummy to water level and bob up and down
if object position y(1)<object position y(water)+0.2 then position object 1,object position x(1),object position y(water)+0.2+0.1*sin(theta#*5),object position z(1)
endfunction
function intro
`camera zoom effect
position camera object position x(1),curvevalue(object position y(1),camera position y(),80),curvevalue(object position z(1),camera position z(),80)
camy#=get ground height(1,camera position x(),camera position z())+0.2
if camy#<object position y(water)+0.2 then camy#=object position y(water)+0.2
position camera camera position x(),camy#,camera position z()
if camera position z()>object position z(1)-0.2
introover=1:info=1
position camera object position x(1),object position y(1),object position z(1)
endif
endfunction
`subroutine for setting character options etc.
beginning:
play sound 4:play sound 5:play sound 6
fog color 0
fadein#=0
repeat
fog color rgb(fadein#*0.01*180,fadein#*0.01*180,fadein#*0.01*250)
for object=water to sphere3
set alpha mapping on object,fadein#
next object
inc fadein#,0.5
sync
until fadein#=>100
wait 1000
play sound 3
repeat
text 0,20,"This is an automated message from the Blue Island Central Information System."
text 0,40,"Please enter your user name:"
if keydown=0
letter$=inkey$()
name$=name$+letter$
if keystate(14)=1 then name$=left$(name$,len(name$)-2)
keydown=1
endif
if inkey$()="" and keystate(14)=0 then keydown=0
text 0,80,name$
sync
until returnkey()=1
repeat
ink 0,0
text 0,20,"Greetings, "+name$+". You are being scanned. Please wait......"
ink rgb(0,255,0),0
line 0,y,screen width(),y
line 0,screen height()-y,screen width(),screen height()-y
inc y,4
sync
until y>=screen height()
ink 0,0
text 0,20,"You have been cleared for access."
text 0,40,"Press any key to transport to shore."
sync
wait key
return
function createsound(name$,soundnumber,frequency#,length#,loudness#,bend#,decay#,vibratospeed#,vibratodepth#,tremelospeed#,tremelodepth#,attack#)
outWord as word
dword1 as dword: dword2 as dword: dword3 as dword: dword4 as dword
dword5 as dword: dword6 as dword: dword7 as dword
samples=int((length#/1000)*44100)
if memblock exist(1) then delete memblock 1
make memblock 1,samples*2+28
` write 28 memblock header bytes
dword1=1 ` gg query: is this the number of channels?
dword2=2 ` gg query: is this the number of bytes per sample?
dword3=22050 ` gg query: seems to be half the number of samples per second - why?
dword4=88200 ` gg query: is this the number of bytes per second?
dword5=4 ` gg query: what does this represent?
dword6=16 ` gg query: (ditto) ?
dword7=0 ` gg query: (ditto) ?
position=0
write memblock dword 1, position, dword1 : inc position,4
write memblock dword 1, position, dword2 : inc position,4
write memblock dword 1, position, dword3 : inc position,4
write memblock dword 1, position, dword4 : inc position,4
write memblock dword 1, position, dword5 : inc position,4
write memblock dword 1, position, dword6 : inc position,4
write memblock dword 1, position, dword7 : inc position,4
rem generate and write wave
riseinloudness#=loudness#
for x=1 to samples
outInteger=int(sin((x/122.5)*(frequency#+vibratodepth#*sin(theta#)))*(loudness#-fallinloudness#-riseinloudness#+tremelodepth#*sin(phi#)))*3.0
if outInteger <-32767 then outInteger=-32767 ` gg query: is this the valid range?
if outInteger>32767 then outInteger=32767 ` gg query: (ditto) ?
outWord=outInteger
inc theta#,vibratospeed#
inc phi#,tremelospeed#
dec frequency#,bend#
if fallinloudness#<loudness#
inc fallinloudness#,decay#
endif
if riseinloudness#>0
dec riseinloudness#,attack#
endif
write memblock word 1, position, outWord : inc position,2
next x
if sound exist(soundnumber)=1 then delete sound soundnumber
make sound from memblock 999, 1 ` assumes you won't need sound number 999!
clone sound soundnumber, 999
delete sound 999
` memblock no longer required
delete memblock 1
endfunction
display_message:
if info=1
if dingplayed=0 then play sound 3:dingplayed=1
text 0,20,"Transport complete. Please proceed to the Information Building (the tallest building on the island)"
text 0,40,"to receive further instructions. Use arrowkeys to move."
inc messagetime
if messagetime>300 then info=0:messagetime=0:dingplayed=0
endif
if info=2
if dingplayed=0 then play sound 3:dingplayed=1:unlocked=1:gotnavigator=1
text 0,20,"We're glad you finally made it, "+name$+". Your task is to find the weapon, and"
text 0,40,"move it clear of the rising water. Unfortunately, it's location is unknown."
text 0,60,"This key will enable you to unlock the doors of all buildings on the island."
text 0,80,"And you might find this electronic navigation system useful too."
text 0,100,"Get searching, "+name$+", and good luck."
inc messagetime
if messagetime>1000 then info=0:messagetime=0:dingplayed=0
endif
if info=3
if dingplayed=0 then play sound 3:dingplayed=1:ink rgb(0,255,0),0
text 0,20,"Don't get too excited ......."
text 0,40,"That's as far as the storyline goes at the moment - "
text 0,60,"there's no actual bomb yet! Feel free to keep roaming - why not go for a swim? ;)"
inc messagetime
if messagetime>1000 then info=0:messagetime=0:dingplayed=0
endif
return
function titles()
sync
set text font "arial"
set text size 60
ink rgb(120,120,250),0
text 300,50,"Blue Island"
set text size 20
text 200,200,"Attention: Blue Island is in trouble."
text 200,220,"A massive tectonic shift has caused a surge in sea water, which"
text 200,240,"will almost completely submerge the island within 3 hours."
text 200,280,"All citizens have been evacuated, but one vital item remains"
text 200,300,"left on the island - a nuclear weapon. Unfortunately, it is set"
text 200,320,"to detonate upon contact with water. This would result in the "
text 200,340,"complete annihilation of Blue Island. Your job is to make sure this"
text 200,360,"this doesn't happen."
text 200,400,"Press any key to continue"
sync
wait key
cls
text 0,20,"Please wait...."
sync
endfunction
function make_tower()
tower=check_free_object_number()
make object box tower,2,10,2
texture object tower,housetexture
set object cull tower,0
scale object texture tower,20,40
roof=check_free_object_number()
make object box roof,2.5,2,2.5
color object roof,rgb(80,80,80)
position object roof,0,5,0
glue object to limb roof,tower,0
spire=check_free_object_number()
make object cone spire,2
color object spire,rgb(80,80,80)
position object spire,0,6,0
glue object to limb spire,tower,0
towerdoor=check_free_object_number()
make object box towerdoor,0.2,0.4,0.02
texture object towerdoor,doortexture
repeat
x=rnd(matrixsize)
z=rnd(matrixsize)
position object tower,x,get ground height(1,x,z),z
until object position y(tower)>3
position object towerdoor,object position x(tower),get ground height(1,object position x(tower),object position z(tower)-0.991)+0.2,object position z(tower)-0.992
`yrotate object tower,rnd(360)
endfunction
function enter_tower
inroom=1
hide light 1
hide light 2
show light 3
position object 1,0,2003,-4
point object 1,0,2003,5
endfunction
function make_table(number)
table(number)=check_free_object_number()
make object box table(number),4,0.1,2
color object table(number),rgb(200,100,60)
leg1=check_free_object_number()
make object box leg1,0.1,2,0.1
position object leg1,-1.95,-1,-0.95
glue object to limb leg1,table(number),0
leg2=check_free_object_number()
make object box leg2,0.1,2,0.1
position object leg2,1.95,-1,-0.95
glue object to limb leg2,table(number),0
leg3=check_free_object_number()
make object box leg3,0.1,2,0.1
position object leg3,-1.95,-1,0.95
glue object to limb leg3,table(number),0
leg4=check_free_object_number()
make object box leg4,0.1,2,0.1
position object leg4,1.95,-1,0.95
glue object to limb leg4,table(number),0
collisiondummy(number)=check_free_object_number()
make object box collisiondummy(number),4,4,2
hide object collisiondummy(number)
glue object to limb collisiondummy(number),table(number),0
endfunction
function make_tower_room()
wall1=check_free_object_number()
make object box wall1,20,10,0.1
position object wall1,0,2004.8,-10
texture object wall1,wallpaper
scale object texture wall1,10,10
wall2=check_free_object_number()
make object box wall2,20,10,0.1
position object wall2,0,2004.8,10
texture object wall2,wallpaper
scale object texture wall2,10,10
wall3=check_free_object_number()
make object box wall3,20,10,0.1
yrotate object wall3,90
position object wall3,-10,2004.8,0
texture object wall3,wallpaper
scale object texture wall3,10,10
wall4=check_free_object_number()
make object box wall4,20,10,0.1
yrotate object wall4,90
position object wall4,10,2004.8,0
texture object wall4,wallpaper
scale object texture wall4,10,10
floor=check_free_object_number()
make object box floor,20,20,0.1
xrotate object floor,90
position object floor,0,1999.8,0
color object floor,rgb(100,10,200)
ceiling=check_free_object_number()
make object box ceiling,20,20,0.1
xrotate object ceiling,90
position object ceiling,0,2006,0
make_table(tower)
position object table(tower),0,2002,0
make light 3
position light 3,0,2004,-0.1
set light range 3,5
lamp=check_free_object_number()
make object plain lamp,0.5,0.5
position object lamp,0,2004,0
texture object lamp,light
set object transparency lamp,5
lampshade=check_free_object_number()
make object cone lampshade,1
position object lampshade,0,2004,0
ghost object on lampshade,3
lampwire=check_free_object_number()
make object plain lampwire,0.02,4
position object lampwire,0,2006,0.01
key=check_free_object_number()
make object sphere key,0.2
color object key,rgb(255,255,0)
position object key,0,2002.15,0
keyshaft=check_free_object_number()
make object box keyshaft,0.5,0.1,0.1
color object keyshaft,rgb(255,255,0)
position object keyshaft,0.25,2002.15,0
navigator=check_free_object_number()
make object box navigator,0.5,0.2,0.3
color object navigator,rgb(255,0,50)
position object navigator,-1,2002.15,0
internaltowerdoor=check_free_object_number()
make object plain internaltowerdoor,2,4
position object internaltowerdoor,0,2001.8,-9.89
color object internaltowerdoor,rgb(220,20,50)
endfunction
function exit_tower
position object 1,object position x(tower),object position y(1),object position z(tower)
set object to object orientation 1,tower
move object 1,-2
yrotate object 1,180
show light 1
inroom=0
endfunction
function setup_navigator
fog off
set ambient light 80
set current bitmap 1
cls
cx#=camera position x()
cy#=camera position y()
cz#=camera position z()
position camera matrixsize/2.0,100,matrixsize/2.0
xrotate camera 90
mapimage=check_free_image_number()
sync
get image mapimage,0,0,screen width(),screen height(),1
set current bitmap 0
xrotate camera 0
position camera cx#,cy#,cz#
map=check_free_object_number()
make object plain map,1,1
texture object map,mapimage
position object map,2,-1.5,4
set object light map,0
lock object on map
hide object map
fog on
fog color rgb(180,180,250)
fog distance matrixsize*0.6
set ambient light 20
pointer=check_free_object_number()
make object cone pointer,0.05
color object pointer,rgb(255,0,0)
position object pointer,2,-1.5,3.9
set object emissive pointer,rgb(250,0,0)
lock object on pointer
hide object pointer
endfunction
function navigate
show object pointer
show object map
if inroom=0
position object pointer,1.95+(object position x(1)-matrixsize/2.0)/matrixsize*0.55,-1.5+(object position z(1)-matrixsize/2.0)/matrixsize*1.1,3.9
zrotate object pointer,-object angle y(1)
endif
endfunction
The nav system now works (not extremely accurate, but useable I think). Also it uses a static image now rather than a live camera, so game speed should be increased.
Other features I didn't already mention:
- footstep sounds ... press <shift> to run, and the sounds speed up to.
- Bobbing up and down effect when in water!
- Wave noise gets louder when you get closer to the water
- You can enter all houses (if you get the key), but there is only actually one room for all the houses, to save on polygons - later I might do some randomizing of the furnature so it always looks different.
- Intro scene and story line!
- Message alerts at various stages with cool 'ding' noise!
Might have one last stab at it later.