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.

Dark GDK / find sprite's pixel x and pixel y coordinates?

Author
Message
xbandages
14
Years of Service
User Offline
Joined: 30th Mar 2010
Location: Michigan
Posted: 1st Apr 2010 23:54
Is it possible to find each pixels x and y coordinates? I'm not asking about the sprite's location as a whole...just the individual pixels for each sprite, and I also want to exclude the transparent color (in my case R255,0G,B255).

thanks
Cuddle Bunniezzz 12
15
Years of Service
User Offline
Joined: 14th Jan 2009
Location: Buffalo, NY
Posted: 2nd Apr 2010 01:30
Well, there is no real pre-built in function to do that, but you could do something like this, to start out:



I'm away from the documentation right now, so I can't really do much to help other then this. Though I do think you may need to use mem-blocks.

Question:
Are you trying to create a pixel perfect collision system?

http://www.darkgdk.us/ <- You can now submit pages, upload images, yet were lacking content. We need your help!
xbandages
14
Years of Service
User Offline
Joined: 30th Mar 2010
Location: Michigan
Posted: 2nd Apr 2010 02:06 Edited at: 2nd Apr 2010 02:20
lol, yes i am. I think i'll be able to do it with the coordinates

Oh, and your code is what I i'll be doing once I can tell the difference between the sprites background and sprite itself.
haliop
User Banned
Posted: 3rd Apr 2010 17:49
what you should do is:

create a new clean bitmap (so you have a clean background)
xbandages
14
Years of Service
User Offline
Joined: 30th Mar 2010
Location: Michigan
Posted: 3rd Apr 2010 18:25
I think i'm gonna head in a new direction with this. Instead of checking for the sprites transparent background....I will instead check for their outline color (R39,G39,B3). I didn't think of this till I looked at a bunch of sprites I found online and realized they all had this kind of outline. I will just fill the array with 1's for outline (and maybe whats in between) and everything else w/ 0's. I currently have this working, but I'm kind of lost on the animations (how are they divided?).

Anyhow if you could elaborate a little more on the create new bitmap method, I'd be interested. Who knows, maybe my method is crap, lol.
xbandages
14
Years of Service
User Offline
Joined: 30th Mar 2010
Location: Michigan
Posted: 3rd Apr 2010 18:28
Also, would creating this new bitmap eachtime for the whole image cause a performance hit? My technique does a little bit when you are very close to the other object, but i'm sure I can fix that.

Login to post a reply

Server time is: 2024-11-20 01:28:43
Your offset time is: 2024-11-20 01:28:43