| 307 | |
| 308 | // Use mask-based collision detection. |
| 309 | function cloudCollide(tag, board, sw) { |
| 310 | sw >>= 5; |
| 311 | var sprite = tag.sprite, |
| 312 | w = tag.width >> 5, |
| 313 | lx = tag.x - (w << 4), |
| 314 | sx = lx & 0x7f, |
| 315 | msx = 32 - sx, |
| 316 | h = tag.y1 - tag.y0, |
| 317 | x = (tag.y + tag.y0) * sw + (lx >> 5), |
| 318 | last; |
| 319 | for (var j = 0; j < h; j++) { |
| 320 | last = 0; |
| 321 | for (var i = 0; i <= w; i++) { |
| 322 | if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) |
| 323 | & board[x + i]) return true; |
| 324 | } |
| 325 | x += sw; |
| 326 | } |
| 327 | return false; |
| 328 | } |
| 329 | |
| 330 | function cloudBounds(bounds, d) { |
| 331 | var b0 = bounds[0], |