It seems that while Angled Box is available as a collision method, the Event for toggling collision types at runtime does not list it - it still has only point, box and per pixel.
Does anyone know of a workaround if one needs to toggle collision modes on the fly? Thanks.
Maybe edit the collision mask of your shape to fill the whole box? That way it acts similar to "Angled Box" when its actually "Per Pixel"
That's what I want to avoid.
To give a wider perspective - I have a game where the player can see very far into the playing filed (meaning a lot of objects are visible), but only interacts with a few of them at a time (the ones closest to him).
I've tried handling visibility checks using "Per Pixel" collisions and overlap tests, but the performance was rather poor - that's why I thought of doing visiblity using "Angled Box", but switching to "Per-Pixel" for player interaction (collision, to be precise).
Due to the nature of the game, "Box" will not do - the objects are elongated Sprites, so "Box" would create a lot of false visibility positives.
Currently, I have it solved using a shrunk-down copy of the playing field set to per-pixel collisions - the performace is acceptable, but I have a large Event Sheet just for that purpose. Plus it complicates Pairing tasks.
Thanks for your assistance.
You might find some benefit from my method of Line Of Sight checking in I Had Hope: http://www.scirra.com/forum/topic53629.html
I made a cap of just the technique here as well though https://dl.dropbox.com/u/4714446/CustomLOS.cap
Develop games in your browser. Powerful, performant & highly capable.
Thank you for the .cap, however this technique requires me to fire several "traces" (the red boxes) to accurately check for visibility - think of it as a field-of-view cone. I'm now checking if that approach is faster than the downscaled playfield I'm using. It definitelly seems much direct and cleaner. Thanks again.
I was trying to find do a cone of vision as well when I realized you can use one trace for each enemy/object and make it the width of the object and always connect to the player.
If the trace doesn't overlap a solid object then your object has a clear pathway to the player, and then you can do distance(player.x,player.y,enemy.x,enemy.y) comparisons to decide how aggressive/what actions the enemy does.