Just a box collision function thats way faster than the original collision functions.
function collide(o1,o2,objectwidth,objectdepth,objectheight,nocollide,maxobjects)
yep=0
if o1<>o2
if o2>0
if object position x(o1)<object position x(o2)+objectwidth and object position x(o1)>object position x(o2)-objectwidth
if object position z(o1)<object position z(o2)+objectdepth and object position z(o1)>object position z(o2)-objectdepth
if object position y(o1)<object position y(o2)+objectheight and object position y(o1)>object position y(o2)-objectheight
yep=1
endif
endif
endif
endif
if o2=0
for j=1 to maxobjects
if object position x(o1)<object position x(j)+objectwidth and object position x(o1)>object position x(j)-objectwidth
if object position z(o1)<object position z(j)+objectdepth and object position z(o1)>object position z(j)-objectdepth
if object position y(o1)<object position y(j)+objectheight and object position y(o1)>object position y(j)-objectheight
yep=1
if j=nocollide then yep=0
endif
endif
endif
next j
endif
endif
endfunction yep
A simple collision function.
You must specify what objects to check for collision for o1 and o2.
objectwidth and objectdepth should be the width and depth of the collision box for o2
should o2 be 0, the function will search for collision from 1 to maxobjects
if nocollide is >0, if an object collides with the object specified
in nocollide, it will return 0.
Edit: Put code in code snippet box, source button screwed up the code. Rich, could you add code editing when editing posts?
Yet Another Edit: Forgot to have it check for y collision, heh.
Yet Another Edit: I'm an idiot, I didnt check my code entirely to see if it worked completely right, found 6 bugs which are now fixed, and it should work now!
Hell Begins September 2nd at 7:30 AM. Yep, schools starting soon. Ordered Dark Basic Pro. 1-3 Weeks remaining!