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 / Help with Matrix Boundaries

Author
Message
Knight mare
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: United States
Posted: 3rd Jan 2004 02:11 Edited at: 3rd Jan 2004 02:12
I have a cube object running around on a matrix, but i can't seem to stop it from running offscreen. Here's the code i've been trying, but for some reason it doesn't want to work.

X# = OBJECT POSITION X(1)
Z# = OBJECT POSITION Z(1)
IF X#<5 AND X#>95 AND Z#<5 AND Z#>95
X# = X#-3
Z# = Z#-3
ENDIF

The matrix is 100x100.
Now, shouldn't the X#-3 move the object back when it gets to the boundaries?

indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 3rd Jan 2004 02:16
rewrite your code like this for a simple boundary effect.

naturally allter to suit regarding the integer sizes

Knight mare
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: United States
Posted: 3rd Jan 2004 02:46
Doesn't work.
Is there anything else i should put for that to work with an AI controlled object? That's the only reason i can see as to why it isn't working.

JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 3rd Jan 2004 03:51
it should work if you do this:

100 being the size of the matrix, but i think that the number would be 100*matrix x tiles and 100 * matrix z tiles

indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 3rd Jan 2004 04:16
darwin you cut n pasted the last two lines and forgot to alter the x to z
Knight mare
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: United States
Posted: 3rd Jan 2004 06:00
lol, that's the exact same code. If it didn't work the first time, it's not going to work this time.

JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 3rd Jan 2004 07:35
lol...so sue me, i didnt read your post...

indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 3rd Jan 2004 08:49
it will work but keep in mind the size its stopping and the VARIABLE name has to be exact.
Knight mare
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: United States
Posted: 3rd Jan 2004 20:03
Well it doesnt work, for the second time, but thanks anyway. I'll figure it out myself eventually.

FROGGIE!
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: in front of my computer
Posted: 3rd Jan 2004 20:18
all the other post are for sliding collision. I think you mean you want the object to get to the boundry then move away from it. try this code:



remember to put before the loop:

xmove# = [3 or -3]
zmove# = [3 or -3]

otherwise it wont move at all

():x:x::::::::::::
ReD_eYe
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 3rd Jan 2004 20:58
you said its not player controlled right? so your probably teling it to just "move object" every loop, when it hits the sides its just gonna go through them, so instead of positioning the object somewhere else,just rotate it when it reaches the edge


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 4th Jan 2004 06:35
well it should work and has been working here for years in simple tests. check your layout of code, its probably something over riding it.

Login to post a reply

Server time is: 2025-06-07 11:15:41
Your offset time is: 2025-06-07 11:15:41