Change Collision Mode to Angled Box Event missing?

For questions about using Classic.

Post » Sun Dec 09, 2012 7:10 am

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.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Sun Dec 09, 2012 11:43 am

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"
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sun Dec 09, 2012 12:41 pm

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.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Mon Dec 10, 2012 12:29 am

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
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Tue Dec 11, 2012 2:17 pm

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.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Tue Dec 11, 2012 2:41 pm

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.Jayjay2012-12-11 14:41:56
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests