Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mashandar

Pages: [1]
1
Graphics / Wierd glitch after using FlipX()
« on: May 08, 2009, 03:36:20 pm »
Hooray!  :D

2
Graphics / Wierd glitch after using FlipX()
« on: May 08, 2009, 06:13:10 am »
I already check a rect intersection in my game, I don't have it in my sample code to keep things simple.

as for the GetPixel not handling rotation and scaling, isn't that what
TransformToLocal is for? I've been using sprites of many different
scales and (after this fix), have been running/colliding perfectly.

3
Graphics / Wierd glitch after using FlipX()
« on: May 07, 2009, 07:12:45 pm »
Aha!

Thanks, that worked perfectly!
I recompiled SFML on my machine with that for now, hopefully it'll be fixed in future SFML releases too, as that bug had me confused for a week. (I assumed it was my code's fault....as it tends to be most of the time)

4
Graphics / Wierd glitch after using FlipX()
« on: May 06, 2009, 01:24:04 pm »
Well, I'm still stumped. I tried some different things, like getting pixels from the source image itself while taking the flipping into account (I kinda knew it wouldn't work but thought it couldn't hurt to give it a go.) with no luck still.

I would really like to get this working, so if anyone has any suggestions, please let me know.

5
Graphics / Wierd glitch after using FlipX()
« on: May 04, 2009, 09:33:46 am »
Oh, ok.

I'll try that when I get the chance.

6
Graphics / Wierd glitch after using FlipX()
« on: April 29, 2009, 05:46:44 pm »
Hello,
         I finally got my pixel-perfect collision detection working but It's acting
         funky after using FlipX(true) on a sprite. when I check GetPixel to see
         what's going on, it's reporting that pixels are there, when, visually
         nothing is seen, so the pixels shouldn't be there (the alpha values
         of these pixels is 255).

         I have uploaded the image to imagebin and a sample test
         code to pastebin which shows this.

        Code: http://pastebin.com/m53275387
        Image: http://imagebin.ca/view/5qzsUj5.html

         I'm rather baffled, so I'm hoping someone can help.

EDIT: in the given example, if compiled, you'll see the flipped sprites (top sprites) colliding permaturely (stopping before reaching the other sprite)
and the unflipped sprites (bottom sprites) colliding as they should.

7
Graphics / TransformToLocal/TransformToGlobal Confusion
« on: April 24, 2009, 11:54:13 am »
I was stewing on this problem for a while now, but I finally figured it out!

out of pure silliness, I forgot the check the alpha values of one of the sprites,
and was only checking the alpha value of the second sprite. silly me.

8
Graphics / TransformToLocal/TransformToGlobal Confusion
« on: April 23, 2009, 12:30:33 pm »
Actually, that may be it.

I was using a scale of 1 in my test case, but the sprites
in my game code varies in size. I'll give that a shot.

EDIT: nevermind, that didn't seem to work.

9
Graphics / TransformToLocal/TransformToGlobal Confusion
« on: April 23, 2009, 06:51:26 am »
Interestingly, I wrote the small test, and everything seems to work.

I guess it must be something to do with my game code.

I apologise for the time I wasted.

Thanks.

10
Graphics / TransformToLocal/TransformToGlobal Confusion
« on: April 22, 2009, 05:23:13 pm »
Hello,
I'm trying to implement a pixel based collision detection,
and what I planned to do was to iterate through the pixels of one
sprite (go from 0,0 to sprite.GetSize().x, sprite.GetSize().y respectively),
use TransformToGlobal to get a global co-ordinate, then use the
opposing sprite's TransformToLocal, to check whether that pixel position
in that opposing sprite's space.

unfortunately, after using TransformToLocal on the opposing sprite, I
get unusual results.

Example

Sprite 1 Position: 265.83, 599.309
Sprite 2 Position: 327.316, 596.533

(Using TransformToGlobal)
Sprite 1 Global Position of 0, 0: 233.83, 567.309
Sprite 2 Global Position of 0, 0: 295.316, 564.533

(Using TransformToLocal of sprite 1's global position of (0, 0) on sprite 2)
-1229.72, 55.5112 -> Unusual  

Here's some code to help explain what I'm doing:

Code: [Select]
sf::Vector2f pos1, pos2;
sf::Color colour;
int i;

for(i=0;i<sprite1.GetSize().x;i++) {
  for(j=0;j<sprite1.GetSize().y;j++) {
    pos1 = sprite1.TransformToGlobal(sf::Vector2f(i, j));
    pos2 = sprite2.TransformToLocal(pos1);

    if (<pos2's value is not invalid. eg. >= (0,0) or < sprite2.GetSize()>) {
     colour = sprite2.GetPixel(pos2);
     if (colour.a > 0) { return true; }
    }
  }
}

return false;

etc.

now in the cases I have been testing, the rotation and scale and even
center points on each object are the same, and I'm rather stumped as
to why wierd values are coming out. (especially such large negative values, I had values going up to -6000+)

I really hope someone can help.

Regards,
             Mashandar

P.S. I apologise for the large posting, I just wanted to make sure there's
plenty of information about my problem.

Pages: [1]