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.

Newcomers DBPro Corner / how do i make my box walk ontop of the matrix and not through it

Author
Message
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 17th Jun 2004 06:19
when my box moves around it just goes through it and off of the side

the box has the matrix like half way through it

also how do i make the box stop when it is at the end of the matrix

any other suggestions for my code are welcome

thx!

mulletman47@aol.com
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Jun 2004 15:53
You need to position the box correctly when you create it. The placement point for the cube is at its centre, so you just need to move it up a bit.



To stop the cube going outside of the matrix bounds, simply take a snapshot of the current coords, then move the object. Then you can test if the object has moved out of bounds, and reposition it if it has.

Just one little point with your code - don't use fall-throughs ('player' falls through to 'controls'). Make sure that each subroutine is separate and correctly terminated or you will end up with difficult-to-find bugs.

Even better - use functions instead

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
GameKit
21
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 17th Jun 2004 22:11
To make the box walk ontop of the matrix, add this line of code near the end of your main loop...

Position Object 1,Object Position X(1),Get Ground Height(1, Object Position X(1),Object Position Z(1))+5,Object Position Z(1)

...To make the box not able to leave the matrix, use...

If Object Position X(1)<0 then Position Object 1,0,Get Ground Height(1,0,Object Position Z(1))+5,Object Position Z(1)
If Object Position X(1)>50 then Position Object 1,50,Get Ground Height(1,50,Object Position Z(1))+5,Object Position Z(1)
If Object Position Z(1)<0 then Position Object 1,Object Position X(1),Get Ground Height(1,Object Position X(1),0)+5,0
If Object Position Z(1)>50 then Position Object 1,Object Position X(1),Get Ground Height(1,Object Position X(1),50)+5,50

...Also add this line of code underneath your "Prepare Matrix Texture" code...

Randomize Matrix 1,10

...Well... I hope I helped...

Programming isn’t an addiction, its more of a mental and social dependancy.
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 19th Jun 2004 03:55
thx dudes
how would i use functions for this how would i write them

they kinda confuse me

mulletman47@aol.com

Login to post a reply

Server time is: 2024-09-22 14:28:05
Your offset time is: 2024-09-22 14:28:05