When i Use the demo of treeparty i see trees but if i implement sparkys collision and take out the camera controls from the demo the tree disappears
this works, you can see the tree
rem
rem TreeParty Quickie Example
rem
rem Init app
Sw=1024:Sh=768
SET DISPLAY MODE Sw,Sh,32,1
sync on : sync rate 60 : autocam off : hide mouse
SET DIR "C:\Users\paul\Desktop\tlv\"
`SET GLOBAL SHADOW COLOR 0,0,0,1
GLOBAL RADIUS# AS DOUBLE FLOAT : RADIUS# = 15.0
Global PRotY# = 2.0
GLOBAL PRotZ# = 2.0
GLOBAL SKYrotY# = 2.0
Global z# = .05
GLOBAL Bro#=bro#
GLOBAL TER = 90
`------------------------------PLAYER-MOVEMENT-VECTOR----------------------------
GLOBAL vx# AS DOUBLE FLOAT
GLOBAL vy# AS DOUBLE FLOAT
GLOBAL vz# AS DOUBLE FLOAT
GLOBAL gravity# AS DOUBLE FLOAT : gravity# = -0.2
GLOBAL slope# AS DOUBLE FLOAT : slope# = 0.107
GLOBAL ground AS INTEGER : ground = 1
GLOBAL jumptimer AS INTEGER : jumptimer = 0
GLOBAL speed AS DOUBLE FLOAT
GLOBAL view as integer : view = 1
rem Backdrop and camera settings
set camera range 0,0.5,95000000
color backdrop rgb(100,100,122)
position camera 32000, 650 ,32000
ter=90
load image "packdirt.png",25
load image "Levels\1\Terrain\tlv_tex2.png",26
load image "tlv_grass_dirt.png",22
`load image "grass11s.png",22
load image "Levels\1\Terrain\color.png",21
load image "Levels\1\Terrain\color2.png",34
`load image "Levels\1\Terrain\rock4s_disp.png",3
LOAD IMAGE "sandripple1.png",23
LOAD IMAGE "grayrock.png",33
LOAD IMAGE "hardDirt.png",24
`LOAD IMAGE "waterrock.JPG",25
PYR = 1 ` Player Object Value
DUMMY = 9000
`================================================================================
`=--------------------------CHARACTER-LOAD-PLAYER-------------------------------=
`================================================================================
MAKE OBJECT SPHERE PYR,radius#
`POSITION OBJECT PYR,-2500,20000,-2500
`POSITION OBJECT PYR,1858.51428223,166.409194947,-2282.37159203
HIDE OBJECT PYR
MAKE OBJECT SPHERE DUMMY,radius#*.05
POSITION OBJECT DUMMY, 13597,1316,7463 ` 0,1180,0
HIDE OBJECT DUMMY
`POSITION OBJECT PYR,2119,6000,-2500
`POSITION OBJECT intBoxNum, pxp#,PYP#,PZP#
`POSITION CAMERA 1,4000,100,4000
`phy make rigid body dynamic sphere dummy
sc_setupobject dummy,0,1
T_Dummy = 567
make object sphere T_Dummy,500
hide object T_Dummy
`==================
Type tWorld
CameraRange#
EndType
Global World As tWorld
Type tSkybox
X#
Y#
Z#
ImageNo
ObjectNo
EndType
Dim Skybox(5) As tSkybox
`====================================================================================================================
`====================================================================================================================
`====================================================================================================================
World.CameraRange# = 4000000000.0:`Whoops, I forgot to include the size of the skybox!!!!!
Path$ = ".\Images\":` And the forum Mangled the slashes out of this string!
`Position Camera 0.0, World.CameraRange# / 16.0, 0.0:` I'll move the camera up a bit so you can see the skybox better!
`====================================================================================================================
`====================================================================================================================
`====================================================================================================================
MakeSky( Path$ )
`------------------Terrain------------------------
MAKE OBJECT TERRAIN ter ` CREATE THE TERRAINt
SET TERRAIN HEIGHTMAP ter, "levels\1\terrain\TLV_TER12.jpg" ` SET THE HEIGHTMAP
SET TERRAIN SCALE ter,17,15,17 `16, 14 ,16`14,6,14 ` SET THE SCALE
SET TERRAIN SPLIT ter,32 ` SPLIT VALUE BY 16 * 16
SET TERRAIN TILING ter, 1 ` DETAIL MAP TILING
set terrain light 90,1,-0.25,0,1,1,0.78,50
` SET TERRAIN LIGHT ter,1, -0.25, -1,.15, .18, .29, 1000 ` LIGHT - XDIR, YDIR, ZDIR, RED, GREEN, BLUE, INTENSITY
`SET TERRAIN TEXTURE ter, 26 ,25 ` base and detail texture
BUILD TERRAIN ter ` finally build the terrain
`texture object ter ,26,25
`texture object ter ,1,13
`texture object ter ,3,23
`set bump mapping on ter,47
` SET object SMOOTHING ter,100
`SET OBJECT ter,1,1,1
` SET OBJECT FOG ter,1
`POSITION OBJECT ter,0,0,0
`set object effect ter,1
`SET OBJECT TEXTURE TER,2,1
`PHY MAKE RIGID BODY STATIC TERRAIN TER
Y# = GET TERRAIN ground HEIGHT(ter,x#,z#)
`SC_SETUPcomplexobject 90,1,1234
` // Setup object
Load Effect "efx/TextureBlend.fx" ,20 , 0 , 1
Set Object Effect ter , 20
` // Assign all 8 texture stages
Texture Object ter , 0 , 21 ` // Layer mask map 1(for stages 3,4,5)
Texture Object ter , 1 , 34 ` // Layer mask map 2(for stages 6,7,4)
texture Object ter , 2 , 25 ` // Base texture(requires no mask)
Texture Object ter , 3 , 22
Texture Object ter , 4 , 33
Texture Object ter , 5 , 23
Texture Object ter , 6 ,24
Texture Object ter , 7 ,24
rem TREEPARTY : Create trees
tx# = 0
ty# = 0
tz# = 0
treename$="tree_birch.tree"
gosub dtInitVars
treeID=dt_LoadTree(treename$)
` dt_Rotate(treeID, rnd(5), rnd(360), rnd(5))
dt_position(treeID, tx#, ty#, tz#)
dt_XScaleX(treeID, 5)
PXP# = OBJECT POSITION X(PYR)
PYP# = OBJECT POSITION Y(PYR)
PZP# = OBJECT POSITION Z(PYR)
` SET CAMERA RANGE 0,1,95000000
rem Main loop
do
`
update terrain 1
`AI UPDATE
rem Camera movement
if keystate(200)=1 then move camera 100
if keystate(208)=1 then move camera -10
if keystate(203)=1
holdy#=camera position y()
rotate camera camera angle x(), camera angle y()-90, camera angle z()
move camera 55
rotate camera camera angle x(), camera angle y()+90, camera angle z()
position camera camera position x(), holdy#, camera position z()
endif
if keystate(205)=1
holdy#=camera position y()
rotate camera camera angle x(), camera angle y()+90, camera angle z()
move camera 10
rotate camera camera angle x(), camera angle y()-90, camera angle z()
position camera camera position x(), holdy#, camera position z()
endif
position listener camera position x(), camera position y(), camera position z()
rotate listener camera angle x(), camera angle y(), camera angle z()
if keystate(1)=1 then end
`
rem TREEPARTY : Press SPACE for gust of wind
if keystate(57)=1 then dt_StartWindGust(30,1,.005)
rem TREEPARTY : Update tree subsystem
`
mmx=mousemovex() : mmy=mousemovey()
position mouse screen width()/2, screen height()/2
cx#=cx#+mmy/2 : cy#=cy#+mmx/2
if cx#>59 then cx#=59
if cx#<-50 then cx#=-50
rotate camera cx#,cy#,0
rem User prompt
center text screen width()/2,screen height()-40,"[ARROWKEYS + MOUSELOOK] to move around [SPACE] for wind [Q] to quit"
dt_update(0)
`
rem Update screen
FASTSYNC
`
rem Quit when Q-KEY pressed
loop
delete bitmap 1
rem TREEPARTY : Free tree resources
`dt_clearall()
rem End program
Function MakeSky( Path$ )
Set Camera Range 0.1, World.CameraRange# + ( World.CameraRange# / 2.0 )
For Id = 1 To 5
Skybox( Id ).X# = 0.0
Skybox( Id ).Y# = 0.0
Skybox( Id ).Z# = 0.0
Skybox( Id ).ImageNo = LoadImage( Path$ + Str$( Id ) + ".bmp" )
Skybox( Id ).ObjectNo = GetBlankObjNo()
Make Object Plain Skybox( Id ).ObjectNo, World.CameraRange# + 5.0, World.CameraRange# + 5.0
Texture Object Skybox( Id ).ObjectNo, Skybox( Id ).ImageNo
Set Object Light Skybox( Id ).ObjectNo, 0
Set Object Filter Skybox( Id ).ObjectNo, 0
Select Id
Case 1
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z# + ( World.CameraRange# / 2.0 )
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
Case 2
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X# + ( World.CameraRange# / 2.0 ), Skybox( Id ).Y#, Skybox( Id ).Z#
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
Case 3
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z# - ( World.CameraRange# / 2.0 )
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
Case 4
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X# - ( World.CameraRange# / 2.0 ), Skybox( Id ).Y#, Skybox( Id ).Z#
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
Case 5
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y# + ( World.CameraRange# / 2.0 ), Skybox( Id ).Z#
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
EndSelect
Next Id
EndFunction
Function GetBlankImgNo()
For Num = 65500 To 1 Step -1
If Image Exist(Num) = 0
ExitFunction Num
EndIf
Next Num
EndFunction 0
Function GetBlankObjNo()
For Num = 65500 To 1 Step -1
If Object Exist(Num) = 0
ExitFunction Num
EndIf
Next Num
EndFunction 0
Function LoadImage( Filename$ )
If File Exist( Filename$ ) <> 1
Img = GetBlankImgNo()
Bmp = GetBlankImgNo()
Create Bitmap Bmp, 64, 64
Set Current Bitmap Bmp
Center Text 32, 22, "Blank"
Center Text 32, 42, "Texture"
Flip Bitmap Bmp
Get Image Img, 0, 0, 64, 64, 1
Set Current Bitmap 0
Delete Bitmap Bmp
EndIf
If File Exist(Filename$) = 1
Img = GetBlankImgNo()
Load Image Filename$, Img, 1
EndIf
EndFunction Img
doent work cant see trees
rem
rem TreeParty Quickie Example
rem
rem Init app
Sw=1024:Sh=768
SET DISPLAY MODE Sw,Sh,32,1
sync on : sync rate 60 : autocam off : hide mouse
SET DIR "C:\Users\paul\Desktop\tlv\"
`SET GLOBAL SHADOW COLOR 0,0,0,1
GLOBAL RADIUS# AS DOUBLE FLOAT : RADIUS# = 15.0
Global PRotY# = 2.0
GLOBAL PRotZ# = 2.0
GLOBAL SKYrotY# = 2.0
Global z# = .05
GLOBAL Bro#=bro#
GLOBAL TER = 90
`------------------------------PLAYER-MOVEMENT-VECTOR----------------------------
GLOBAL vx# AS DOUBLE FLOAT
GLOBAL vy# AS DOUBLE FLOAT
GLOBAL vz# AS DOUBLE FLOAT
GLOBAL gravity# AS DOUBLE FLOAT : gravity# = -0.2
GLOBAL slope# AS DOUBLE FLOAT : slope# = 0.107
GLOBAL ground AS INTEGER : ground = 1
GLOBAL jumptimer AS INTEGER : jumptimer = 0
GLOBAL speed AS DOUBLE FLOAT
GLOBAL view as integer : view = 1
rem Backdrop and camera settings
set camera range 0,0.5,95000000
color backdrop rgb(100,100,122)
position camera 32000, 650 ,32000
ter=90
load image "packdirt.png",25
load image "Levels\1\Terrain\tlv_tex2.png",26
load image "tlv_grass_dirt.png",22
`load image "grass11s.png",22
load image "Levels\1\Terrain\color.png",21
load image "Levels\1\Terrain\color2.png",34
`load image "Levels\1\Terrain\rock4s_disp.png",3
LOAD IMAGE "sandripple1.png",23
LOAD IMAGE "grayrock.png",33
LOAD IMAGE "hardDirt.png",24
`LOAD IMAGE "waterrock.JPG",25
PYR = 1 ` Player Object Value
DUMMY = 9000
`================================================================================
`=--------------------------CHARACTER-LOAD-PLAYER-------------------------------=
`================================================================================
MAKE OBJECT SPHERE PYR,radius#
`POSITION OBJECT PYR,-2500,20000,-2500
`POSITION OBJECT PYR,1858.51428223,166.409194947,-2282.37159203
HIDE OBJECT PYR
MAKE OBJECT SPHERE DUMMY,radius#*.05
POSITION OBJECT DUMMY, 13597,1316,7463 ` 0,1180,0
HIDE OBJECT DUMMY
`POSITION OBJECT PYR,2119,6000,-2500
`POSITION OBJECT intBoxNum, pxp#,PYP#,PZP#
`POSITION CAMERA 1,4000,100,4000
`phy make rigid body dynamic sphere dummy
sc_setupobject dummy,0,1
T_Dummy = 567
make object sphere T_Dummy,500
hide object T_Dummy
`==================
Type tWorld
CameraRange#
EndType
Global World As tWorld
Type tSkybox
X#
Y#
Z#
ImageNo
ObjectNo
EndType
Dim Skybox(5) As tSkybox
`====================================================================================================================
`====================================================================================================================
`====================================================================================================================
World.CameraRange# = 4000000000.0:`Whoops, I forgot to include the size of the skybox!!!!!
Path$ = ".\Images\":` And the forum Mangled the slashes out of this string!
`Position Camera 0.0, World.CameraRange# / 16.0, 0.0:` I'll move the camera up a bit so you can see the skybox better!
`====================================================================================================================
`====================================================================================================================
`====================================================================================================================
MakeSky( Path$ )
`------------------Terrain------------------------
MAKE OBJECT TERRAIN ter ` CREATE THE TERRAINt
SET TERRAIN HEIGHTMAP ter, "levels\1\terrain\TLV_TER12.jpg" ` SET THE HEIGHTMAP
SET TERRAIN SCALE ter,17,15,17 `16, 14 ,16`14,6,14 ` SET THE SCALE
SET TERRAIN SPLIT ter,32 ` SPLIT VALUE BY 16 * 16
SET TERRAIN TILING ter, 1 ` DETAIL MAP TILING
set terrain light 90,1,-0.25,0,1,1,0.78,50
` SET TERRAIN LIGHT ter,1, -0.25, -1,.15, .18, .29, 1000 ` LIGHT - XDIR, YDIR, ZDIR, RED, GREEN, BLUE, INTENSITY
`SET TERRAIN TEXTURE ter, 26 ,25 ` base and detail texture
BUILD TERRAIN ter ` finally build the terrain
`texture object ter ,26,25
`texture object ter ,1,13
`texture object ter ,3,23
`set bump mapping on ter,47
` SET object SMOOTHING ter,100
`SET OBJECT ter,1,1,1
` SET OBJECT FOG ter,1
`POSITION OBJECT ter,0,0,0
`set object effect ter,1
`SET OBJECT TEXTURE TER,2,1
`PHY MAKE RIGID BODY STATIC TERRAIN TER
Y# = GET TERRAIN ground HEIGHT(ter,x#,z#)
`SC_SETUPcomplexobject 90,1,1234
` // Setup object
Load Effect "efx/TextureBlend.fx" ,20 , 0 , 1
Set Object Effect ter , 20
` // Assign all 8 texture stages
Texture Object ter , 0 , 21 ` // Layer mask map 1(for stages 3,4,5)
Texture Object ter , 1 , 34 ` // Layer mask map 2(for stages 6,7,4)
texture Object ter , 2 , 25 ` // Base texture(requires no mask)
Texture Object ter , 3 , 22
Texture Object ter , 4 , 33
Texture Object ter , 5 , 23
Texture Object ter , 6 ,24
Texture Object ter , 7 ,24
rem TREEPARTY : Create trees
tx# = 0
ty# = 0
tz# = 0
treename$="tree_birch.tree"
gosub dtInitVars
treeID=dt_LoadTree(treename$)
` dt_Rotate(treeID, rnd(5), rnd(360), rnd(5))
dt_position(treeID, tx#, ty#, tz#)
dt_XScaleX(treeID, 5)
PXP# = OBJECT POSITION X(PYR)
PYP# = OBJECT POSITION Y(PYR)
PZP# = OBJECT POSITION Z(PYR)
` SET CAMERA RANGE 0,1,95000000
rem Main loop
do
`
oldx# = OBJECT POSITION X(dummy)
oldy# = OBJECT POSITION Y(dummy)
oldz# = OBJECT POSITION Z(dummy)
camx# = CAMERA POSITION X(0)
camy# = CAMERA POSITION Y(0)
camz# = CAMERA POSITION Z(0) rem apply gravity, and user changes to movement
angy# = OBJECT ANGLE Y(dummy)
vx# = 0
vz# = 0
bx# = 0
bz# = 0
cax# = camera ANGLE X(0)
cay# = camera ANGLE Y(0)
caz# = camera ANGLE Z(0)
rem if not attempt to keep the player stuck to the floor
if shiftkey() = 1
speed = 9
else
speed =0.89
endif
yrotate object DUMMY,object angle Y(DUMMY)+mousemovex()/3.0
xrotate object DUMMY,object angle X(DUMMY)+mousemovey()/3.0
IF OBJECT ANGLE X(DUMMY)>90 THEN XROTATE OBJECT DUMMY,90
IF OBJECT ANGLE X(DUMMY)<-90 THEN XROTATE OBJECT DUMMY,-90
yrotate object PYR,object angle Y(DUMMY)
xrotate object PYR,object angle X(DUMMY)
IF vy#=0 AND jumptimer=0 THEN vy# = vy# + 15*gravity# ELSE vy# = vy# + gravity#
IF KEYSTATE(32)=1 THEN vx# = VX# + COS(angy#)*speed : vz# = -VZ# - SIN(angy#)*speed
IF KEYSTATE(30)=1 THEN vx# =-VX# - COS(angy#)*speed : vz# = VZ# + SIN(angy#)*speed
IF KEYSTATE(31)=1 THEN vx# =-VX# - SIN(angy#)*speed : vz# = -VZ# - COS(angy#)*speed
IF MOUSECLICK()=2 THEN vx# = VX# + SIN(angy#)*speed : vz# = VZ# + COS(angy#)*speed
IF MOUSECLICK()=3 THEN vx# = VX# + SIN(angy#)*speed : vz# = VZ# + COS(angy#)*speed
IF KEYSTATE(31)=1 AND MOUSECLICK()=2 THEN vx# =-VX# - SIN(angy#)*speed : vz# = -VZ# - COS(angy#)*speed
IF KEYSTATE(31)=1 AND KEYSTATE(32)=1
vx# =-VX# - SIN(angy#)*speed : vz# = -VZ# - COS(angy#)*speed
vx# = -VX# + COS(angy#)*speed : vz# = VZ# - SIN(angy#)*speed
ENDIF
IF keystate(31)=1 and keystate(30)=1
vx# =-VX# - SIN(angy#)*speed : vz# = -VZ# - COS(angy#)*speed
vx# = VX# - COS(angy#)*speed : vz# = -VZ# + SIN(angy#)*speed
ENDIF
rem only jump if on ground, and a certain time after last jump
IF GROUND = 0 AND KEYSTATE(43)=1
ANIMATE = ANIMATE + 1
IF animate = 1 THEN POSITION CAMERA 0,camx#,CAMY#-0.5,camz# `move object down pyr,.5
IF animate = 4 THEN POSITION CAMERA 0,camx#,CAMY#-1.0,camz# `move object down pyr,.5
IF animate = 7 THEN POSITION CAMERA 0,camx#,CAMY#-1.5,camz# `move object down pyr,.5
IF animate = 10 THEN POSITION CAMERA 0,camx#,CAMY#-2.0,camz# `move object down pyr,.5
IF animate = 15 THEN POSITION CAMERA 0,camx#,CAMY#-1.5,camz# `move object down pyr,.5
IF animate = 18 THEN POSITION CAMERA 0,camx#,CAMY#-1.0,camz# `move object down pyr,.5
IF animate = 21 THEN POSITION CAMERA 0,camx#,CAMY#-0.5,camz# `move object down pyr,.5
IF animate = 22 THEN animate = 0
ENDIF
IF ground=1
IF spacekey()=1 AND jumptimer=0 THEN vy# = vy# + 5.2 : jumptimer = 10
ENDIF
DX# = OBJECT POSITION X(DUMMY)
DY# = OBJECT POSITION Y(DUMMY)
DZ# = OBJECT POSITION Z(DUMMY)
rem this would be the player's final position without collision
x# = oldx#+vx#
y# = oldy#+vy#
z# = oldz#+vz#
rem first handle gravity - seperated from horizontal movement
rem to achieve a more realistic effect
rem Method: simple - cast a sphere vertically down, if it hits the level then
rem position the object there (sticky collision) then move
rem on to horizontal movement
rem more complex - if we were to only use the simple method the player would be
rem allowed to climb almost vertical slopes. Alternative is to
rem get the normalY direction to work out how flat the gorund
rem below the player is, 0-slope# is flatter, slope#-1 is steeper.
rem if it's flat, use sticky collision, if it's steep slide the
rem player down the slope. Changing slope# determines how steep the
rem player can climb. NOTE: this also effects stairs.
collide = sc_SphereCastGroup(0,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
IF collide>0
rem how flat is this ground
ny# = sc_getCollisionNormalY()
IF ABS(ny#)>slope#
rem FLAT, stick
oldy# = sc_getStaticCollisionY()
ELSE
rem STEEP, slide
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
ENDIF
rem ny#<0 means the player has hit a ceiling rather than a floor
IF ny#>slope#
rem only on ground if standing on flat ground
ground = 1
vy# = 0
ELSE
ground = 0
rem if player has hit a flat ceiling then stop vy# movement
IF ny#<-slope# THEN vy# = gravity#
ENDIF
ELSE
rem nothing below player, not on ground, add vertical speed to player
oldy# = oldy# + vy#
ground = 0
ENDIF
rem jumptimer will decrease only when player is back on ground
rem creates a pause between two successive jumps
IF ground = 1 AND jumptimer>0 THEN DEC jumptimer
rem handle horizontal movement as sliding
rem player only collides with group 1 (level) objs and moves freely through others
collide = sc_SphereSlideGroup(0,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
IF collide>0
rem if hit, reposition player, halt movement vector
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
rem possible code for giving the player a jumping help up stairs...
rem might be useful if slope# is set very high but stairs are still required
` dy# = oldy#-sc_getStaticCollisionY()
`if dy#<slope# and dy#>0 and ground=1 then vy# = 0.5
ENDIF
rem position the player
`POSITION OBJECT PYR,PXP#,Y# +50,PZP#
POSITION OBJECT DUMMY,x#,OLDY#,z#
POSITION OBJECT PYR,OBJECT POSITION X(DUMMY),OBJECT POSITION Y(DUMMY),OBJECT POSITION Z(DUMMY)
position object T_Dummy,OBJECT POSITION X(DUMMY),OBJECT POSITION Y(DUMMY),OBJECT POSITION Z(DUMMY)
sc_updateObject DUMMY
`function positionCameraToObject(obj,thirdPerson)
POSITION CAMERA 0, OBJECT POSITION X(pyr),OBJECT POSITION Y(pyr),OBJECT POSITION Z(PYR)
ROTATE CAMERA 0,OBJECT ANGLE X(PYR),OBJECT ANGLE Y(PYR),OBJECT ANGLE Z(PYR)
`if thirdPerson=1
`pitch camera down 1, 10
`move camera 1,-30
`endif
`endfunction
` position object ene, object position x(ene), get terrain ground height(ter, object position x(ene), object position z(ene)),object position z(ene)
` position object ene1, object position x(ene1), get terrain ground height(ter, object position x(ene1), object position z(ene1)),object position z(ene1)
update terrain 1
`AI UPDATE
rem User prompt
center text screen width()/2,screen height()-40,"[ARROWKEYS + MOUSELOOK] to move around [SPACE] for wind [Q] to quit"
dt_update(0)
`
rem Update screen
FASTSYNC
`
rem Quit when Q-KEY pressed
loop
delete bitmap 1
rem TREEPARTY : Free tree resources
`dt_clearall()
rem End program
Function MakeSky( Path$ )
Set Camera Range 0.1, World.CameraRange# + ( World.CameraRange# / 2.0 )
For Id = 1 To 5
Skybox( Id ).X# = 0.0
Skybox( Id ).Y# = 0.0
Skybox( Id ).Z# = 0.0
Skybox( Id ).ImageNo = LoadImage( Path$ + Str$( Id ) + ".bmp" )
Skybox( Id ).ObjectNo = GetBlankObjNo()
Make Object Plain Skybox( Id ).ObjectNo, World.CameraRange# + 5.0, World.CameraRange# + 5.0
Texture Object Skybox( Id ).ObjectNo, Skybox( Id ).ImageNo
Set Object Light Skybox( Id ).ObjectNo, 0
Set Object Filter Skybox( Id ).ObjectNo, 0
Select Id
Case 1
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z# + ( World.CameraRange# / 2.0 )
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
Case 2
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X# + ( World.CameraRange# / 2.0 ), Skybox( Id ).Y#, Skybox( Id ).Z#
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
Case 3
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z# - ( World.CameraRange# / 2.0 )
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
Case 4
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X# - ( World.CameraRange# / 2.0 ), Skybox( Id ).Y#, Skybox( Id ).Z#
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
Case 5
Position Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y# + ( World.CameraRange# / 2.0 ), Skybox( Id ).Z#
Point Object Skybox( Id ).ObjectNo, Skybox( Id ).X#, Skybox( Id ).Y#, Skybox( Id ).Z#
EndCase
EndSelect
Next Id
EndFunction
Function GetBlankImgNo()
For Num = 65500 To 1 Step -1
If Image Exist(Num) = 0
ExitFunction Num
EndIf
Next Num
EndFunction 0
Function GetBlankObjNo()
For Num = 65500 To 1 Step -1
If Object Exist(Num) = 0
ExitFunction Num
EndIf
Next Num
EndFunction 0
Function LoadImage( Filename$ )
If File Exist( Filename$ ) <> 1
Img = GetBlankImgNo()
Bmp = GetBlankImgNo()
Create Bitmap Bmp, 64, 64
Set Current Bitmap Bmp
Center Text 32, 22, "Blank"
Center Text 32, 42, "Texture"
Flip Bitmap Bmp
Get Image Img, 0, 0, 64, 64, 1
Set Current Bitmap 0
Delete Bitmap Bmp
EndIf
If File Exist(Filename$) = 1
Img = GetBlankImgNo()
Load Image Filename$, Img, 1
EndIf
EndFunction Img