Percentage overlap of two objects?

Get help using Construct 2

Post » Wed Mar 02, 2016 7:21 pm

Hi all,

How would I get Construct 2 to tell the player how much one object overlaps with another object? For example, if the player is placing an object like a burger patty on top of a bun, how would I code the game such that the player gets a percentage accuracy score for how well they placed the patty?

Any help would be appreciated! :)
B
3
S
1
Posts: 4
Reputation: 333

Post » Wed Mar 02, 2016 7:44 pm

The overlap at offset command allows sub-pixels, such as 15.9 or 6.3.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 534
Reputation: 19,620

Post » Wed Mar 02, 2016 9:54 pm

The hackier/simpler way that I thought of first was just to check the distance between the center of the patty and the center of the bun. Unless there is a reason you need to get the specific area overlapped - and that can still be calculated from the distance if both shapes are fixed size circles.

When you have irregular shapes or multiple instances of shapes, it gets more complicated though, and I don't have a quick answer for that.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests