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 / matrix question

Author
Message
Xarshi
19
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 15th Jan 2006 07:02
how would you make your character slide downward if the matrix was steep enough? is this even possible? and how would you make it so the character cant climb a steep part of the matrix?

HARK!
Dark Lord
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location: Australia
Posted: 15th Jan 2006 11:28 Edited at: 15th Jan 2006 11:29
I would get the ground height a few units infront of the player and then calculate a gradient but there is probably a better way.
Quote: "is this even possible?"
- I am pretty sure I have seen it done before but that may of been with DarkBasic Pro.
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Jan 2006 12:07
Quote: "I would get the ground height a few units infront of the player and then calculate a gradient but there is probably a better way."


No, this is probably the only way. With matrices ofcourse.

Get the height of the players left, right, front and back, and calculate the steepness. You can use these values for sliding down a hill.
If you have troubles with it, check the DBC tutorial of Binary Moon.



If you want to stop the character if the hill is too steep, you only have to calculate the height in the direction the player is going. If the difference with the object's current y-position is too high, don't move the object.

Another way to do it:
store the player's height, move, get player's height again and compare it to the last player's height. If that difference is too big, reset the object to its original position.

Both ways are practically the same.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Xarshi
19
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 15th Jan 2006 20:43
ok.ive tried storing the player height data.that didnt work.this is the code i used:

but that didnt work.what am i doing wrong?

HARK!
Dark Lord
19
Years of Service
User Offline
Joined: 19th Aug 2005
Location: Australia
Posted: 17th Jan 2006 03:47 Edited at: 17th Jan 2006 03:49
In that example there you are setting ph# & ph2# to the same value. Try having an oldph# and ph#, and set the oldph# before you get the keyboard input.

[edit] While executing your program use 'Print' statements to check the value of the variables.
Xarshi
19
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 19th Jan 2006 01:31
i tried setting it before the control input.it didnt work.i think i could try using ph#= the camera height and ph2#= the camera height-1,but that would not do anything now that you think about it.

HARK!
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 19th Jan 2006 19:13


Is your code. But did you move between the data collection?

It should be something like this:


Good luck.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.

Login to post a reply

Server time is: 2025-05-23 00:28:37
Your offset time is: 2025-05-23 00:28:37