6

I'm making a game in javascript (for IE 10) that has a colision system. I want to colide the objects only when 2 visible parts colide, i want to ignore the transparent parts of the images.

Has any way to know if a position from an < img > is transparent or not?

Bruno Croys Felthes
  • 1,183
  • 8
  • 27

2 Answers2

4

'Burn' the image into an HTML5 canvas, then get the specific pixel from the canvas and check its Alpha (http://falcon80.com/HTMLCanvas/PixelManipulation/getImageData.html).

I think it would be easier if you only worked with HTML5 canvas instead of moving around DOM segments.

hyankov
  • 4,049
  • 1
  • 29
  • 46
0

Check the following post :

You can use an image with the old-fashioned < map > and < area > tags.

Hover only on non-transparent part of image

Community
  • 1
  • 1
Anass
  • 974
  • 1
  • 6
  • 14