[img]c:p1.bmp[/img]
[img]c:p2.bmp[/img]
Ok i'm having some more trouble. When I run my game and try to walk up something it is 2 whole units ahead of the existng object. Any ideas?
rem special edit
autocam off : sync rate 60
hide mouse : sync on
rem Make a player object (and a non-rotated collision box for it)
make object sphere 11,3
position object 11,0,0,0
scale object 11,300,300,300
set object speed 11,10
rem Make sky blue
color backdrop rgb(0,0,255)
rem Make a simple scene for the camera to look at
make matrix 1,10000.0,10000.0,25,25
load bitmap "white01.bmp",1
get image 1,0,0,70,70
delete bitmap 1
prepare matrix texture 1,1,2,2
randomize matrix 1,0.10
set matrix height 1,8,8,100
position matrix 1,-500,0,-500
update matrix 1
rem Make temple work
load object "temple.x",36
position object 36,-220,-7,0
scale object 36,100,120,100
make object collision box 36,-15,-7,-28,7,6,33,0
make object box 37,1,50,74
position object 37,-205,0,3
make object box 38,1,50,74
position object 38,-245,0,3
make object box 39,40,50,1
position object 39,-224,0,42
hide object 37
hide object 38
hide object 39
rem Make citie's walls, make them solid, & color them
load image "rocky01.bmp",2
make object box 20,700,500,5
position object 20,0,0,-347.5
make object box 21,300,500,5
position object 21,-202.5,0,350
make object box 22,300,500,5
position object 22,202.5,0,350
make object box 23,5,500,700
position object 23,-350,0,0
make object box 24,5,500,700
position object 24,350,0,0
for t=20 to 24
texture object t,2
make static object t
objx#=object position x(t)
objy#=object position y(t)
objz#=object position z(t)
objsx#=object size x(t)/2.0
objsy#=object size y(t)/2.0
objsz#=object size z(t)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#
delete object t
next t
rem Make road
load image "floor3.bmp",3
make object box 31,300,3,40
position object 31,0,0,-140
texture object 31,3
scale object texture 31,2,10
make object box 32,300,3,40
position object 32,0,0,140
texture object 32,3
scale object texture 32,2,10
make object box 33,40,3,320
position object 33,150,0,0
texture object 33,3
scale object texture 33,10,2
make object box 34,40,3,320
position object 34,-150,0,0
texture object 34,3
scale object texture 34,10,2
for t=31 to 34
make static object t
objx#=object position x(t)
objy#=object position y(t)
objz#=object position z(t)
objsx#=object size x(t)/2.0
objsy#=object size y(t)/2.0
objsz#=object size z(t)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#+3.5,objz#+objsz#
delete object t
next t
rem Make gate that goes up and down when aproached
load image "c_vwood1.bmp",4
make object box 35,105,300,0.1
position object 35,0,40,350
texture object 35,4
rem Make Granite Houses & make them solid
load object "granite house.x",25
position object 25,-80,0,-60
load object "granite house.x",26
position object 26,-220,0,-200
load object "granite house.x",27
position object 27,-140,0,-200
load object "granite house.x",28
position object 28,-200,0,230
rotate object 28,0,180,0
load object "granite house.x",29
position object 29,260,0,0
rotate object 29,0,270,0
load object "granite house.x",30
position object 30,260,0,80
rotate object 30,0,270,0
for t=25 to 30
make static object t
objx#=object position x(t)
objy#=object position y(t)
objz#=object position z(t)
objsx#=object size x(t)/2.0
objsy#=object size y(t)/2.0
objsz#=object size z(t)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#+2,objy#+objsy#+20,objz#+objsz#+2
delete object t
next t
rem Main loop
do
rem Make print objects position
set cursor 0,0
print posx#
set cursor 0,15
print posy#
set cursor 0,30
print posz#
set cursor 0,45
print addheight
rem Store old positions
oldposx#=object position x(11)
oldposy#=object position y(11)
oldposz#=object position z(11)
rem Control player object
if upkey()=1
move object 11,2
endif
if downkey()=1 then move object 11,-2
if leftkey()=1 then yrotate object 11,wrapvalue(object angle y(11)-3)
if rightkey()=1 then yrotate object 11,wrapvalue(object angle y(11)+3)
rem Control animation
if object playing(11)=1 and upkey()=0 then stop object 11
rem Get current object position
posx#=object position x(11)
posy#=object position y(11)
posz#=object position z(11)
rem Handle sliding collision for player object with other objects
position object 11,posx#,posy#,posz#
if object collision(11,0)>0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
endif
rem test
if posx# <=-203 and posx# >=-204 and posz# <=42 and posz# >= -38 then posx# = posx# + 2
rem Set a size for the player object
s#=object size y(11)/2.0
rem Make gate go up & down
if posz# >=320 and posz# <=360 and posx# >=-60 and posx# <=60 then position object 35,0,300,350
if posz# <=320 or posz# >=360 then position object 35,0,0,350
rem Ensure camera stays out of static collision boxes
if get static collision hit(oldposx#-s#,oldposy#-s#,oldposz#-s#,oldposx#+s#,oldposy#+s#,oldposz#+s#,posx#-s#,posy#-s#,posz#-s#,posx#+s#,posy#+s#,posz#+s#)=1
dec posx#,get static collision x()
dec posy#,get static collision y()
dec posz#,get static collision z()
if get static collision y()<>0.0 then playergrav#=0.0
endif
rem Use camera tracker to follow player object
angle#=object angle y(11)
camdist#=25.0 : camhigh#=posy#+10.0 : camfade#=3.5
set camera to follow posx#,posy#,posz#,angle#,camdist#,camhigh#,camfade#,1
rem Get add height to work
if get static collision hit(oldposx#-s#,oldposy#-s#,oldposz#-s#,oldposx#+s#,oldposy#+s#,oldposz#+s#,posx#-s#,posy#-s#,posz#-s#,posx#+s#,posy#+s#,posz#+s#)=1
addheight = addheight + 2
endif
rem Add height
posy# = get ground height(1,posx#,posz#)+s#^2+2+addheight
rem Update with new object position
position object 11,posx#,posy#,posz#
rem Tilt camera down a little
xrotate camera 15
rem Update screen
sync
rem End loop
loop