for keeping below an altitude:
if player position y(1)>10
position object 1,object position x(1),10,object position z(1)
turn object 1,180
move object 1,.3
turn object 1,180
endif
Change the "10"s to whatever altitude you want to stop at.
For keeping away from certain incline angles:
if abs(lastheight-get ground height (1,x#,z#))>2
turn object 1,180
move object 1,.3
turn object 1,180
endif
lastheight=get ground height (1,x#,z#)
It's not perfect but you will get the idea.
Here's both of those placed in your code:
Rem Project: Basic_RPG_Test_(soon to be awesome)
Rem Created: 1/30/2006 4:52:32 PM
Rem ***** Main Source File *****
remstart __________________________________________
| |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|<------------Part 1-setting up game------------->|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|_________________________________________________|
remend
`-------------------------------------------------------------------------------------------------------------------
`--------------------------
`Chapter 1-Create world |
`--------------------------
`Setup
set display mode 640,480,16
autocam off
sync on
sync rate 0
set camera view 0,0,640,480
color backdrop rgb(0,0,0)
`----------------------------
`Chapter 2-Load all media |
`----------------------------
rem Activate and distance fogging
fog on
fog distance 3000
fog color RGB(0,0,0)
`Load the world
gosub load_map
`----------->>>load images<<<-------------
`------------------------------------------
rem make character
load object "models/character.x",1
scale object 1,350,350,350
`load image "models/dogotaur.bmp",2
`texture object 1,2
color object 1,rgb(255,100,100)
rem sync mouse
sync on : hide mouse
`place player near the center of the matrix
position object 1,2623,5,661
make light 1
rem Standard conversion for DM2 object use
`xrotate object 1,270
`fix object pivot 1
`-------------------------------------------------------------------------------------------------------------------
`__________________________________________________
`| |
`|||||||||||||||||||||||||||||||||||||||||||||||||||
`|<--------Part 2-Put all of it together---------->|
`|||||||||||||||||||||||||||||||||||||||||||||||||||
`|_________________________________________________|
`-----------------------
`Chapter 4-Main loop |
`-----------------------
`------------------------------------------
`Main loop
do
set ambient light 5
position light 1,X#,Y#+50,Z#
`print "FPS: ",screen fps()
`player movement and turning
if keystate (17)=1 then move object 1, .30 : set object speed 1,1 : loop object 1,1,18
if keystate (31)=1 then move object 1, -.3
if keystate (30)=1 then yrotate object 1, object angle y(1) - .3
if keystate (32)=1 then yrotate object 1, object angle y(1) +.3
if (ScanCode() = 0) then loop object 1,0,0
`make it so that the character stays above the matrix
if player position y(1)>10
position object 1,object position x(1),10,object position z(1)
turn object 1,180
move object 1,.3
turn object 1,180
endif
x# = object position x(1)
y# = get ground height(1,x#,z#)
z# = object position z(1)
y2# = object position y(1)
if abs(lastheight-get ground height (1,x#,z#))>2
turn object 1,180
move object 1,.3
turn object 1,180
x# = object position x(1)
y# = get ground height(1,x#,z#)
z# = object position z(1)
y2# = object position y(1)
endif
lastheight=get ground height (1,x#,z#)
`render all of above X# Y# and Z#
position object 1,x#,y#+25,z#
`place the camera at the players position and face it the same angles it faces
position camera x#, y#, z#
`set camera to object orientation 1
rotate camera object angle x(1), object angle y(1), object angle z(1)
`move camera straight up
xrotate camera 90
move camera -70
`set camera back to players angles and move it behind him
`set camera to object orientation 1
rotate camera object angle x(1), object angle y(1), object angle z(1)
move camera -200
`draw changes
sync
`end loop
loop
load_map:
M=2
if matrix exist(1) then delete matrix 1
load bitmap "LVLHM3.bmp",1
set current bitmap 1
bw=bitmap width(1)-1
bh=bitmap height(1)-1
masix=(bw*100)*M
masiz=(bh*100)*M
make matrix 1,masix,masiz,bw,bh
smx#=((bw*-500)*m)/2
smz#=((bh*-500)*m)/2
if image exist(1) then delete image 1
load image "LVLHM3.bmp",1
prepare matrix texture 1,1,bw,bh
in=0
`bw-1
for x=bh to 1 step -1
for z=1 to bw
in=in+1
set matrix tile 1,z-1,x-1,in
next z
next x
for x=0 to bw
iz=bh+1
for z=0 to bh
iz=iz-1
h=point(x,iz)
h=(rgbr(h)+rgbg(h)+rgbb(h))/3
set matrix height 1,x,z,h*(m+1)
next z
next x
update matrix 1
delete bitmap 1
return
I didn't try it out. If that works, great. If it doesn't, sorry.