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 / Sprite Collision/Hits not behaving as expected

Author
Message
Mungkeh_Man
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 12th Apr 2012 21:55
I've had DB Pro for a week now and have managed to solve most problems as I go (eventually!) but this has me stuck.

The below loop was intend to drop a sprite (15) down the window and print it's number when I click on it with mouse, via a second sprite (1000) that is following it.

However, I only ever get "11" printed, where ever I click!

I appreciate sprite collision is the basis of every 2d game ever and it must work....but cannot see what am I doing wrong:



Thank you in advance for any help whatsoever. I have not found any tutorial that covers this, but if anyone has a link to one I am not scared of self learning!
Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 13th Apr 2012 00:58 Edited at: 13th Apr 2012 00:59
shouldn't this

be like this


Mungkeh_Man
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 14th Apr 2012 12:04
Thank you for the quick response.

As I understand it, that line is correct and leads to something else I have just discovered:

I am using "0" in the Sprite Hit to get the number of the target Sprite as there will be several of this sprite in the game and the player is to pick one.

Now...I have a For Loop that populates the Sprites from preloaded Images and guess what the loop starts counting at: 11.

When I change it to 12 the Sprite Hit prints 12. So it appears that the Sprite Hit is getting the number of first Sprite regardless of what is clicked on.

I am completely puzzled!
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 15th Apr 2012 04:34 Edited at: 22nd Apr 2012 03:40
Quote: "paste sprite 15,20,y `falling target sprite"


sprite collision works with sprites, not pasted sprites:



hope that helps

Virtual Nomad @ California, USA . DBPro V7.5
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit

Attachments

Login to view attachments
Mungkeh_Man
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 17th Apr 2012 21:10
Thank you!

That fixed it, and it would have taken me forever to try that by guess work alone!

Login to post a reply

Server time is: 2024-11-23 21:09:06
Your offset time is: 2024-11-23 21:09:06