Pixel-Problem
-
- Posts: 52
- Joined: Thu Sep 04, 2003 7:45 pm
- Location: Germany
Pixel-Problem
hello!
in my 2d iso strategy game i want to select a tile by mouse. thats almost works fine but the tiles overlap (in most cases only the transparent areas overlap). Now my question: How can I find out to which texture a pixel, that i get from the cursor position, belongs?
hope you understood my problem
in my 2d iso strategy game i want to select a tile by mouse. thats almost works fine but the tiles overlap (in most cases only the transparent areas overlap). Now my question: How can I find out to which texture a pixel, that i get from the cursor position, belongs?
hope you understood my problem
I don't know the answer to your question but what I do know is a place you might find it. www.GameDev.net has a good selection of articles about 2D isometric games in their reference section, you could do a lot worse than read your way through them.
-
- Posts: 52
- Joined: Thu Sep 04, 2003 7:45 pm
- Location: Germany
Take a look at the API. There are some functions, one is called something like "getRayFrom2DCursor" or something like that, and that shoots a 3d line into the world starting from the 2d co-ordinates of the mouse cursor.
Take a look, because it's entirely possible that the function you need is already in the API.
Take a look, because it's entirely possible that the function you need is already in the API.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
-Japanese Proverb
-
- Posts: 52
- Joined: Thu Sep 04, 2003 7:45 pm
- Location: Germany
-
- Posts: 52
- Joined: Tue Mar 30, 2004 12:16 pm
-
- Posts: 52
- Joined: Thu Sep 04, 2003 7:45 pm
- Location: Germany
1. the tile-images overlap. There ist a part of the images which is transparent and that part overlaps with other transparent ones.
2. I got the 2 position of the cursor by using a fuction of a ICursorControl instance.
3. the problem is that i don't know to which image the position belongs.
StuColliers tip isn't useful because i got the 2d coordinates of every image - but only the coordinates of the left upper corner.
2. I got the 2 position of the cursor by using a fuction of a ICursorControl instance.
3. the problem is that i don't know to which image the position belongs.
StuColliers tip isn't useful because i got the 2d coordinates of every image - but only the coordinates of the left upper corner.
-
- Posts: 52
- Joined: Tue Mar 30, 2004 12:16 pm
-
- Posts: 52
- Joined: Thu Sep 04, 2003 7:45 pm
- Location: Germany
Every tile got the same size - they look like this tile.
And i know the size of every tile for sure - the problem is the overlapping transparent area. in the picture the black background is transparent.
And i know the size of every tile for sure - the problem is the overlapping transparent area. in the picture the black background is transparent.
-
- Posts: 52
- Joined: Thu Sep 04, 2003 7:45 pm
- Location: Germany
This is a paste from the irr documentation :
virtual void* irr::video::ITexture::lock ( ) [pure virtual]
Lock function. Locks the Texture and returns a pointer to access the pixels
You could use that fonction to check if the collising texture's pixel is (or not) the transparent color. If no, then COLLISION.
virtual void* irr::video::ITexture::lock ( ) [pure virtual]
Lock function. Locks the Texture and returns a pointer to access the pixels
You could use that fonction to check if the collising texture's pixel is (or not) the transparent color. If no, then COLLISION.