Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / I can't get my people to walk above the matrix

Author
Message
alpha numeric characters
21
Years of Service
User Offline
Joined: 17th Jan 2004
Location:
Posted: 18th Jan 2004 05:10 Edited at: 18th Jan 2004 05:11


How do i get the person to walk above matrix?
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 18th Jan 2004 05:15
autocam off : sync rate 60
hide mouse : sync on

rem Make a player object
load object "person.x",11
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
set matrix height 1,1,1,300.0
randomize matrix 1,10
position matrix 1,-500,0,-500
update matrix 1

rem Make nice building
load object "anonymous.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,5,40
position object 31,0,0,-140
texture object 31,3
scale object texture 31,2,10
make object box 32,300,5,40
position object 32,0,0,140
texture object 32,3
scale object texture 32,2,10
make object box 33,40,5,320
position object 33,150,0,0
texture object 33,3
scale object texture 33,10,2
make object box 34,40,5,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#

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
loop object 11,1,20
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()
playergrav#=0.0
endif

rem test
if posx# <=-203 and posz# <=42 and posz# >= -38 then posx# = posx# + 2
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 Update with new object position
position object 11,posx#,posy#,posz#

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 Try to get object to walk on ground
posy# = get ground height(1,posx#,posz#)

rem---------------------------------------------------
rem THIS IS THE PART I ADDED!!!
Position Object 1,posx#,posy#,posz#
rem---------------------------------------------------

rem Tilt camera down a little
xrotate camera 15

rem Update screen
sync

rem End loop
loop


We need help! Email us! [email protected]
alpha numeric characters
21
Years of Service
User Offline
Joined: 17th Jan 2004
Location:
Posted: 18th Jan 2004 16:51
I see my problem. I position my object and it walks on matrix from there. But i use my objects at such a small scale that if i try to elevate 1 part i i'm stuck underneeth it or i can't find it because it is so far away or if i do find it it is all weird because it jumps out as you get closer. Thx for the help.
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 20th Jan 2004 06:54
WE NEED CODE BOXES
sorry

Login to post a reply

Server time is: 2025-05-22 14:25:41
Your offset time is: 2025-05-22 14:25:41