OK. All right. I tested and fooled around with your code for a while and came up with a few errors and fixed them. They are as follows:
1. The collision was on the wrong object (2) it should've been 4.
2. The positioning was wrong with the wall collision, I sort of fixed that.
There is a minor glitch of backing back through the wall if you turn around. I'm working on that for my own game too. Once I figure it out and fix it I'll post it for you.
Other than that, I added a new string, col4$ and col3$, which is the collision of either object 4 or 5, which just tells where the collision is at, by the up key or down key.
Here is the fixed code:
Rem * Title : 3d test working
Rem * Author : David B
Rem * Date : today!
sync on
sync rate 100
remstart
make object sphere 5,5
make object sphere 6,5
make object sphere 7,5
make object sphere 8,5
remend
up$="yes"
down$="yes"
make matrix 1,400,400,50,50
load image "twigs.bmp",1
prepare matrix texture 1,1,1,1
fill matrix 1,0,1
delete image 1
load image "clouds.bmp",1
texture backdrop 1
delete image 1
ink rgb(111,111,111),0
load object "alien2.3ds",1
load image "tree.bmp",1
load object "tree-top.3ds",2
load object "tree-trunk.3ds",4
texture object 4,1
scale object 4,5000,3000,5000
scale object 2,5000,3000,5000
delete image 1
load image "tree-top.bmp",1
texture object 2,1
load image "bricks.bmp",1
make object cube 3,20
scale object 3,2000,300,100
position object 3,200,object position y(3),10
texture object 3,1
delete image 1
set object collision on 1
set object collision on 2
set object collision on 3
number = 1
tree = 2
x#=0
y#=0
z#=0
posx#=150
posy#=5
posz#=150
up$="yes"
down$="yes"
col4$="no"
col3$="no"
`position object 4,200,0,250
`position object 2,200,object position y(2),250
`make static object 4
`make static object 2
remstart
position object 4,200,0,300
make static object 4
position object 2,200,object position y(2),300
make static object 2
remend
position object 2,200,object position y(2),350
position object 4,200,0,350
top:
x#=0
y#=0
z#=0
position object 1,posx#,posy#,posz#
posx#=150
posy#=5
posz#=150
down=0
do
sync
oldposx#=object position x(1)
oldposy#=object position y(1)
oldposz#=object position z(1)
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
text 10,400,"FPS: "+str$(screen FPS())
text 10,10,"X: "+str$(object position x(1))
text 10,50,"y: "+str$(object position y(1))
text 10,30,"Z: "+str$(object position z(1))
text 10,70,"Collide: "+str$(object collision(1,3))
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
angle#=object angle y(1)
camdist#=25.0 : camhigh#=posy#+10.0 : camfade#=3.5
set camera to follow object position x(1),object position y(1),object position z(1),angle#,camdist#,camhigh#,camfade#,1
`Movement
if upkey()=1 and up$="yes" then move object 1,3
if downkey()=1 and down$="yes" then move object 1,-3
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-3)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+3)
if spacekey()=1 and playergrav#=0.0 then playergrav#=2.0
rem Collisions
`tree
if upkey()=1 and col4$="no" and object collision(1,4)=1 then up$="no" : col4$="yes"
if downkey()=1 and col4$="no" and object collision(1,4)=1 then down$="no" : col4$="yes"
if upkey()=1 and col4$="yes" and object collision(1,4)=0 then up$="yes" : down$="yes" : col4$="no"
if downkey()=1 and col4$="yes" and object collision(1,4)=0 then up$="yes" : down$="yes" : col4$="no"
`brick wall
if upkey()=1 and col3$="no" and object collision(1,3)=1 then up$="no" : col3$="yes"
if downkey()=1 and col3$="no" and object collision(1,3)=1 then down$="no" : col3$="yes"
if upkey()=1 and col3$="yes" and object collision(1,3)=0 then up$="yes" : down$="yes" : col3$="no"
if downkey()=1 and col3$="yes" and object collision(1,3)=0 then up$="yes" : down$="yes" : col3$="no"
`move object 1,-1
if x# > 180 and x# < 190 and z#> 340 and z# < 370 then move object 1,-3
if x# > 185 and x# < 221 and z#> 330 and z# < 341 then move object 1,-3
if x# > 187 and x# < 215 and z#> 360 and z# < 370 then move object 1,-3
if x# > 210 and x# < 220 and z#> 340 and z# < 360 then move object 1,-3
`IF OBJECT POSITION Z(1) > 400 then down=1
IF OBJECT POSITION Z(1) < 15
position object 1,OBJECT POSITION x(1),OBJECT POSITION y(1),15
endif
if object position y(1) < -700 then goto top
if down=1
dec fall,5
oldfall = fall+10
position object 1,object position x(1),fall,object position z(1)
position camera object position x(1),oldfall,object position z(1)
endif
if object collision(1,3)=1 then move object 1,-3
loop
__________________________________________
<<<<<Check out my sites>>>>>
www.rhettgames.tk | www.slayerbattletanks.tk