Javascript 2D image pixel collision check
Im trying to get pixel collision in one of the games im working on. It has to be a pixel collision on one row of pixels on the X axis. One of the things I tryed was:
var imgData = context2D.getImageData(1开发者_开发百科60, 0, 3, Height);
And Height is afcorse the canvas height. But this gives me a Security error" code: "1000. This only happens if I put this script in front of my Draw function.
Can anybody help me out with this one?
You're probably using a drawImage() somewhere in your draw function with an image not on the same domain. Calling getImageData after drawing an image from another source will result in that error.
精彩评论