Skip to content

Commit

Permalink
added on overlap list of tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomhausen committed Nov 7, 2024
1 parent 42100bd commit 45fec76
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tilesadvanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,23 @@ namespace tilesAdvanced {
})
}

/**
* Run code when a certain kind of sprite overlaps any of the listed tiles
* @param kind
* @param tiles
* @param handler
*/
//% group="Tile Comparisons"
//% weight=120 draggableParameters="reporter" blockGap=8
//% blockId=onoverlaplistoftiles
//% block="on $sprite=sprite of kind $kind=spritekind overlaps $tiles at $location"
//% tiles.shadow=variables_get
export function onOverlapListOfTiles(kind: number, tiles: Image[], handler: (sprite: Sprite, location: tiles.Location) => void) {
for (let tile of tiles) {
scene.onOverlapTile(kind, tile, handler);
}
}

/**
* Returns true if one sprite can see another without a wall in the way
*/
Expand Down

0 comments on commit 45fec76

Please sign in to comment.