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.

Code Snippets / Gravity and Bounce Functions/Engine

Author
Message
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 22nd Jan 2005 18:56
Been working on these functions and would like to test them out. Feel free to use them, just please give me credit (but not the blame ).

Notice that you do not need to keep track of the objects velocities anywhere in your main routine. The cool thing is that the functions handle those values for you.

Please let me know what you think - any comments/advice are welcome and appreciated.

Thanks in advance.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 22nd Jan 2005 23:20
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 23rd Jan 2005 03:36
Hmmm.... what happened?
Here it is.



"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 23rd Jan 2005 07:02 Edited at: 23rd Jan 2005 07:04
OMG that's one hell of a lot of code!! Not trying to be a smartarse, but you could do the same thing in under 40 lines - I don't even want to know why you are using memblocks!

eg: your code (altered slightly to make it work in DBPro)



Same thing in under 40 lines:



Nevertheless, nice effect! You could also add in a scale object command when the ball bounces to make them kind of squidgy!


RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 23rd Jan 2005 08:52

Oh-oh, maybe I didn't explain well (and yep - it's a lot for a simple gravity demo - and thanks, thought it was cool too).

I was trying to use a gravity engine as very simple ai routine (and I do mean v e r y simple) to test the functions; StaticVar() and GetStaticVar() (at the end of all that
Quote: "OMG that's one hell of a lot of code!!"
code.

Expand the concept to more complex ai routines, and a main routine could look nice and neat like:



If the ai functions in the above sample were written so that orcs attack elves and vis-a-versa, that simple bit of code would simulate a battle.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II

Login to post a reply

Server time is: 2024-11-23 17:06:34
Your offset time is: 2024-11-23 17:06:34