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 / HAHA! Genius code...(stairs)

Author
Message
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 17th Oct 2002 04:52
I hate to give out code that takes me so long to write, but I really take pride in this little bit. It's for the sliding collision example, and it impliments the idea of stairs. It takes a lot more to code stairs than you'd think! Anyway, cut the collision code in the sliding collision example (which is this)

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

And replace it with this:
position object 11,posx#,posy#,posz#
hit#=object collision(11,0)
if object collision(11,0)>0
if get object collision y() then playergrav#=0
if (get object collision x())+(get object collision z())
if ((object size(hit#)+object position y(hit#))-posy#)
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 17th Oct 2002 04:53
oh god it cut off everything, here's the code you should repalce it with:

QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 19th Oct 2002 00:28
Where are my legions of followers?
Mirthin
21
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Land of the Rising Haggis
Posted: 19th Oct 2002 00:44
I think everyone got pissed off when you defended your FPS code. But I defended you. Perhaps they're scared of you.
Zenders
21
Years of Service
User Offline
Joined: 4th Oct 2002
Location:
Posted: 27th Nov 2002 17:29
hahahaha i know i'm terrified!
nice code BTW

Ciao

Dave

QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 30th Nov 2002 06:23
awww at least zenders loves me
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 30th Nov 2002 18:20
oh, there's one bug in that which would slow down the framerate. It checks for collision twice in the loop instead of once, and db collision really slows down a program. It works better with:

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 1st Dec 2002 05:21
make it with a distance function and use about 10 objects to get a better result for a real world example.

Relying on the DB collision alone is elephant poo, large smelly and tonnes of it.

QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 1st Dec 2002 21:19
Er....indi...what? This collision code would be if you made a level out of cubes and boxes, you couldnt check the distance between each one in a loop.
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 2nd Dec 2002 01:42
if u replace the object collision with a distance function it will pick up speed dramatically or use a distance function then check for DB collision while turning it on previously and off after the check

Login to post a reply

Server time is: 2024-03-28 19:07:23
Your offset time is: 2024-03-28 19:07:23