Ok, I'm in an
EXTREMELY good mood this morning. Maybe a little too much...
Anyway, I took a look at the link I had posted above myself, and came up with this code...
` set up display and camera
sync on
backdrop on
autocam off
set camera range 0.01, 60000
phy start
phy set gravity 0.0,-150.0,0.0
phy make material 1,"Character Bounce"
phy set material restitution 1,0.01
phy set material dynamic friction 1,0.1
phy build material 1
load image "final.bmp", 1
load image "detail.tga", 2
make object terrain 1
set terrain heightmap 1, "map.bmp"
set terrain scale 1, 12, 0.8, 12
set terrain split 1, 16
set terrain tiling 1, 4
set terrain light 1, 1, -0.25, 0, 1, 1, 0.78, 0.5
set terrain texture 1, 1, 2
build terrain 1
phy make rigid body static terrain 1
make object box 200,256 * 12,(255 * 0.8) * 16,10
make object box 201,256 * 12,(255 * 0.8) * 16,10
make object box 202,10,(255 * 0.8) * 16,256 * 12
make object box 203,10,(255 * 0.8) * 16,256 * 12
make object box 204,256 * 12,10,256 * 12
texture object 200,2
texture object 201,2
texture object 202,2
texture object 203,2
texture object 204,2
position object 200,(256 * 12) / 2,0,0
position object 201,(256 * 12) / 2,0,256 * 12
position object 202,0,0,(256 * 12) / 2
position object 203,256 * 12,0,(256 * 12) / 2
position object 204,(256 * 12) / 2,(((256 * 0.8) * 16) / 2),(256 * 12) / 2
phy make rigid body static box 200
phy make rigid body static box 201
phy make rigid body static box 202
phy make rigid body static box 203
phy make rigid body static box 204
make object sphere 600,40
set object specular 600,rgb(255,255,255)
set object specular power 600,255
set object ambient 600,0
phy make rigid body dynamic sphere 600,1
phy set rigid body position 600,440,200,340
do
angy# = wrapvalue(angy# + mousemovex())
position camera object position x(600) - (sin(angy#) * 150),object position y(600) + 50,object position z(600) - (cos(angy#) * 150)
point camera object position x(600),object position y(600),object position z(600)
if phy get collision data() = 1
ColA = phy get collision object a()
ColB = phy get collision object b()
else
ColA = 0
ColB = 0
endif
if (ColA = 1 and ColB = 600) or (ColA = 600 and ColB = 1)
if keystate(17) = 1
phy add rigid body force 600,sin(camera angle y()) * 1550.0,0.0,cos(camera angle y()) * 1550.0,5
endif
if keystate(31) = 1
phy add rigid body force 600,sin(camera angle y()) * -1550.0,0.0,cos(camera angle y()) * -1550.0,5
endif
if keystate(30) = 1
phy add rigid body force 600,sin(camera angle y() + 90) * -1550.0,0.0,cos(camera angle y() + 90) * -1550.0,5
endif
if keystate(32) = 1
phy add rigid body force 600,sin(camera angle y() + 90) * 1550.0,0.0,cos(camera angle y() + 90) * 1550.0,5
endif
endif
if keystate(17) = 0 and keystate(31) = 0 and keystate(30) = 0 and keystate(32) = 0
phy set rigid body linear damping 600,0.075
phy set rigid body angular damping 600,0.075
else
phy set rigid body linear damping 600,0.0
phy set rigid body angular damping 600,0.0
endif
phy update
sync
loop
that's for if you want to use your own media, it's pretty straight foward. I modified it a little though. Instead of having spheres drop in a line to crash into the ground, I used one sphere, a terrain, and 5 boxes for the enclosement. The sphere may be controlled using the WASD keys, and the mouse x movement controls the direction.
Wow, I could so make a game out of this!!!
And here's a download with all the media I used. Every thing I did with textures was done with MOSTLY Gimp for XP, and the detail texture, which never comes out right on terrain, or I don't know how to use it, was done in Texture Maker 3 Advanced, because I was lazy yesterday. But the Gimp is free, so use it, it can probably make a better detail map than what I made, and...IT'S FREEEEEEEE!!!
Enjoy,
MickeyIII