Ok, a few things. 1st. I've made it so that no matter what Y position the water is, it will ALWAYS detect whether or not the "camera" is above or below the water. 2nd. I'm having a problem adding my perfect camera following routine to the Active Terrains. I'm also having trouble positioning the player object.
Here's the code:
Rem Project: Active Terrain
Rem Created: Sunday, August 28, 2011
Rem ***** Main Source File *****
Sw=800:Sh=600
set display mode Sw,Sh,32
set window on
set window size Sw,Sh
set window position 0,0
global currentpath$
global currentfile$
global TRUE = 1
global FALSE = 0
global badfile
global h
global Sw
global Sh
global encre
global psize
global xPos#
global yPos#
global zPos#
global xAng#
global yAng#
global yAngle = 0
global sav_img$
global sector
global sectx
global secty
global AvatarHeight# = 8.0
global AvatarLevel#
global crange = 2000
global yourjumpspeed#
global yourfallspeed#
global maxjumpheight# = 14.0
global youjumped = FALSE
global swidth
global sheight
global maxsecx
global maxsecy
global fov = 50
global speed#
global factor#
global AboveWater = TRUE
global Img
global ImgSize
global alreadysethereA
global alreadysethereB
AvatarLevel# = AvatarHeight#
// With this being an integer, you can make roughly
// 18,446,744,065,119,617,000 total pixel size (256x256)
// map tiles, give or take. Basically, this can potentially
// be one huge world.
sectx AS DWORD
sectx AS DWORD
maxsecx AS DWORD
maxsecy AS DWORD
sectx = 0
secty = 0
maxsecx = 100 // 100 = Small planet. This is where you setup your map size. If it reaches the max
maxsecy = 100 // size it will then set sect (x) or (y) to 0 or vise versa depending on your location.
yourjumpspeed# = 0.07
yourfallspeed# = 0.06
dimension = 2^12
DIM h(dimension,dimension)
dim encre(15)
swidth = screen width()
sheight = screen height()
gp()
set text size 30
center text swidth / 2,sheight / 2,"Loading Map(s)..."
sync
mapnameis()
sav_img$ = currentfile$
createhmap()
clors()
sync on
hide mouse
loadtheimagesforterrain()
creatthedirt()
global player
player = 100000
make object cube player, 10
// Set up the Camera. The two blues are real sky colors.
//sky blue - 135,206,235
//light sky blue - 135,206,250
autocam off
backdrop on 0
set camera range 0,1,Crange
set camera fov 0,fov
set ambient light 10
color ambient light rgb(135,206,250)
fog on
set point light 0,0,0,100
set light range 0,3000
speed# = 0.2
setupshadows()
xPos# = 496.0
zPos# = 447.0
yPos# = get ground height(1,xPos#,zPos#) + AvatarLevel#
`Position Camera 0,xPos#,yPos#,zPos#
Position Object player, xPos#, yPos#, zPos#
AvatarHeight# = 8.0
//Obj,Shader,Img,ImgSize,Height#
MakeWater(500,500,500,512,60)
facing# = 0.0
camrotate# = 0.0
do
//tbm_Update() //This is the timer function
set cursor 0,0
position mouse 0,0
print "Frames Per Second : ";screen fps()
print "X Position : ";xPos#
print "Y Position : ";yPos#
print "Z Position : ";zPos#
print "Heading : ";yAngle
Print "Sector : " + str$(sectx) + "," + str$(secty)
if AboveWater = TRUE then print "You Above Water ? : TRUE"
if AboveWater = FALSE then print "You Above Water ? : FALSE"
inputloopinghere()
if camera position y(0) < object position y(500) // Sets the brightness and water colors while UNDER water
alreadysethereB = 0
if alreadysethereA = 0
AboveWater = FALSE
color backdrop 0,rgb(0,20,50)
color light 0,0,20,50
alreadysethereA = 1
endif
endif
if camera position y(0) > object position y(500) // Sets the brightness and water colors while ABOVE water
alreadysethereA = 0
if alreadysethereB = 0
AboveWater = TRUE
color backdrop 0,rgb(135,206,235)
color light 0,240,240,240
alreadysethereB = 1
endif
endif
move object player, (upkey()-downkey())*.05
facing# = facing# + .05 * (rightkey()-leftkey())
yrotate object player, facing#
if downkey()
set camera to follow object position x(player), object position y(player), object position z(player), facing#+180, 75, 50, 80, 1
else
set camera to follow object position x(player), object position y(player), object position z(player), facing#, 75, 50, 80, 1
endif
`Position Camera 0,xPos#,yPos#,zPos#
Position Object player, 1500/2, yPos#, 1500/2
Rotate Camera 0,xAng#,yAng#,0
setlightposition()
UpDateWater()
Sync
Loop
show mouse
end
CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !