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 / Adding too much to a variable on collision

Author
Message
scutheotaku
14
Years of Service
User Offline
Joined: 9th Dec 2009
Location:
Posted: 15th Dec 2009 07:04
So, I'm having a problem adding to my score whenever I collide with something.
First of all, here's my collision code (using Sparky's Collision)-



Basically, whats happening is that instead of adding just 1 to the score, it's adding 1 to 10 to the score. Now, I'm assuming that this is because it's constantly colliding with the object (which is a coin, by the way) for a few frames (proper DBPro terminology?). I was hoping to simply avoid this by repositioning the object before adding the score, but this didn't work.

So, how would I got about making sure it adds only 1 point to the score? I came up with a little "trick" using a "lastscore" variable, but I think it was a lot of math going on each step when there's probably an easier way. So, I come to you

Thanks for any help you can give!

PS : Sorry for the bad topic title, but I couldn't think of anything better, haha
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 15th Dec 2009 14:39
Sparky's dll requires you to update the object you're moving. So after you move it call sc_updateObject (I believe thats the command, been a while).
scutheotaku
14
Years of Service
User Offline
Joined: 9th Dec 2009
Location:
Posted: 15th Dec 2009 15:06
DUH, haha. Thanks for the response, putting sc_updateObject in the if then statement fixed it. Not sure why I didn't think of that, but I guess that's why I'm still a newb.

Thanks again!

Login to post a reply

Server time is: 2024-09-28 12:19:43
Your offset time is: 2024-09-28 12:19:43