Vaibhav Devpura
Vaibhav Devpura

Reputation: 104

Touch on visible part of sprite

I'm making a game where I'm using sprites.Here I can move and rotate sprite. I can rotate sprite by touching that one time.But when I touch on transparent area of the sprite it also rotates. So Is there any method that while on touch event I can get that which part was being touched transparent or non-transparent? Any suggestions or help?

Upvotes: 1

Views: 213

Answers (1)

a_schimpf
a_schimpf

Reputation: 765

You have a few options:

  1. make the sprite smaller so that the alpha part won't even make a difference (assuming the alpha part is relatively small)

  2. store some indicator of where the alpha part is in relation to the sprites origin... this would probably be difficult and an approximation (and would be hard if there are multiple alpha sections)

  3. find out the exact alpha component of the pixel you touched... here's how to get the alpha components of an image...How can i to get color/alpha of pixel from Sprite in andengine?

Upvotes: 1

Related Questions