MCPcopy Create free account
hub / github.com/microsoft/SandDance / cloudCollide

Function cloudCollide

docs/tests/v2/es6/js/sanddance.js:125533–125555  ·  view source on GitHub ↗
(tag, board, sw)

Source from the content-addressed store, hash-verified

125531
125532
125533function cloudCollide(tag, board, sw) {
125534 sw >>= 5;
125535 var sprite = tag.sprite,
125536 w = tag.width >> 5,
125537 lx = tag.x - (w << 4),
125538 sx = lx & 0x7f,
125539 msx = 32 - sx,
125540 h = tag.y1 - tag.y0,
125541 x = (tag.y + tag.y0) * sw + (lx >> 5),
125542 last;
125543
125544 for (var j = 0; j < h; j++) {
125545 last = 0;
125546
125547 for (var i = 0; i <= w; i++) {
125548 if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true;
125549 }
125550
125551 x += sw;
125552 }
125553
125554 return false;
125555}
125556
125557function cloudBounds(bounds, d) {
125558 var b0 = bounds[0],

Callers 1

placeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected