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 / just like automatic collision, but not automatic

Author
Message
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 15th Oct 2006 09:52
i need a little help with, i am guessing functons I almos never used them so i dont really know how to write them.

You now how on automatic collion when an object hits something, it gets placed in the last place where it didint hit anything.

i want to make my object do this

so it will be like....

if oject hit(1,2)
get placed to the last place where it didnt hit anything
end if

dont hate people who rip you off,cheat and get away with it, learn from them
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 15th Oct 2006 14:15
That's easy! No functions are required. However, I did write a tutorial on them if you need it.

Okay, now for your question! All you need to do is store where you were before you moved in 3 variables. Then, when you collide with something just position the object at those 3 variables! Here's an example:



And for collision, the (if) OBJECT COLLISION command works better. It's just like (if) OBJECT HIT but it is better for collision. It will check to see if the objects are colliding more than once.

Ummm...
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 15th Oct 2006 20:31
oldY#=object position y(1)

how what does it exactly do?

dont hate people who rip you off,cheat and get away with it, learn from them
PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 16th Oct 2006 06:47
in your example it works great, butwhen i appied it to mine, it just didnt work, i just keep going through buildings and it doesent mke sense

ill figure it out though.

dont hate people who rip you off,cheat and get away with it, learn from them
StevetS
20
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 16th Oct 2006 15:12
Issue 27 of the newsletter has a good tutorial on functions if you want to look into them further (you should - they'll make your life a lot easier!).

Quote: "
oldY#=object position y(1)
how what does it exactly do?
"


You store your current x,y and z positions in a separate variable (oldx, oldy, oldz) BEFORE you move your object then if you collide with anything when you move you can go back to your stored values.
Pseudo-code:

Hope this is clearer


PAGAN_old
18
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 16th Oct 2006 19:33
i figured it out thank you

dont hate people who rip you off,cheat and get away with it, learn from them

Login to post a reply

Server time is: 2024-09-25 11:22:27
Your offset time is: 2024-09-25 11:22:27