开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜