I'm currently porting over some Phaser prototype code to Corona
I have a ball that drops from the top of the screen and collects items on the map from "Layer1" and rebounds off objects on "CollisionLayer".
the collectible items are drawn on a layer in Tiled so currently I'm doing this:
local function onCollision( event ) if ( event.phase == "began" ) then local tile = event.object1 if(tile.layerIndex==1 and not tile.collected) then if(tile.gid < 100) then tile.alpha=0 tile.collected=true end end end end
my questions are
1) i'm currently using a physics layer for Layer1, so every tile is a sensor object to allow overlap check.. so with a lot of tiles, I'm wondering if this is going to kill mobile performance. (in my JS prototype i just checked 8 points around the player which seemed to suffice). any other suggestions welcome! thanks
2) other than setting tile.alpha=0, is there a fast way to remove a tile from the map?
thanks for any advice
great library though.. i got my 3 layer prototype up and running *really* quickly
ps I've attached an image explaining the 8 way basic coordinate check "overlap" method I used in Phaser.. it's accurate enough, just not very!