Detect how much of the screen is occupied.

Get help using Construct 2

Post » Wed Oct 23, 2013 11:15 pm

Is there a way to detect how much of the screen is occupied by objects? for example, 50%?

Like in this game:
http://www.shockwave.com/gamelanding/filler2.jsp

I keep thinking about this, but this surpasses my knowledge.
B
35
S
4
G
5
Posts: 84
Reputation: 4,860

Post » Thu Oct 24, 2013 12:13 am

As long as circles don't overlap:
variable 1 = height of your play area / width of your play area
variable 2 = occupied area, starts at 0

when you create a new circle: add pi*r^2 to variable 2

or via bruteforce, gridbased
2x2 sprite; then scan the whole play area with it by moving it along it step by step and checking for overlaps with the relevant object/family; if it overlaps, add 4 (= 2*2) to variable 2, performance will be really bad though
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Thu Oct 24, 2013 3:51 am

Thanks! It was super easy! I never thought about area :) Basic math
B
35
S
4
G
5
Posts: 84
Reputation: 4,860


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests