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 / collision problem (i think)

Author
Message
gamebird
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 11th Jul 2007 18:13
Could somebody help me with this code? It is supposed to use another hidden sprite to detect areas a tank sprite cannot move onto, but instead it is always moving as if it collided with the sprite. Could somebody tell me what I did wrong?

Attachments

Login to view attachments
Crit
18
Years of Service
User Offline
Joined: 24th May 2006
Location:
Posted: 12th Jul 2007 03:09
Your hidden sprite is taking up the entire screen, so the tank is always colliding with it (darkbasic doesn't do pixel perfect sprite collisions, it only checks if the boxes are overlapping)
gamebird
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 12th Jul 2007 04:59
Quote: "Your hidden sprite is taking up the entire screen, so the tank is always colliding with it (darkbasic doesn't do pixel perfect sprite collisions, it only checks if the boxes are overlapping)"

actually, it does support pixel perfect collisions

what you're talking about


pixel perfect collision
gamebird
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 12th Jul 2007 16:48
Okay, I must have been wrong. I was confused because inside the book it says that SPRITE HIT is pixel perfect, whereas SPRITE COLLISION uses the bounding rectangle. I'll have to use something else I guess.
gamebird
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 12th Jul 2007 21:44
Okay, will try. Thanks.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Jul 2007 03:45
There is a difference between Object Hit and Object collision - Object Hit returns a zero until the moment of impact, reports 1, and then goes back to returning a zero - even if the objects are still overlapping.

Object Collision returns a 1 all the time the objects are overlapping.

I would have thought that the same difference would be found with Sprite Hit and Sprite Collision in DBPro. Isn't this the case?

TDK_Man

Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 13th Jul 2007 08:17
You're right about objects, but for sprites "hit" and "collision" do the exact same thing.

Ex. Arrowkeys move


gamebird
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 13th Jul 2007 16:06
I'm either misunderstanding the book (Dark Basic pro game programming second edition) or its wrong. Thanks for the info.

Login to post a reply

Server time is: 2024-09-27 00:20:02
Your offset time is: 2024-09-27 00:20:02