Consistent collision boxes?

Get help using Construct 2

Post » Fri Jul 20, 2012 12:48 am

In the past, I've used an invisible rectangular platform object to which I would pin the player's animated Sprite. The platform object would also act as the collision object since it only has one frame of animation.

Now that I think about it though, given that you can apply a single bounding box to "All Animations" in the Sprite Editor, why not leave the collision detection in the animated sprite itself? Occasionally, the collision box is going to change (for example if the player ducks, changes size, etc), and that way, when you set the Sprite's Animation to "Anim_Ducking", the game will automatically use the collision polygon in that particular animation. This would also mean that you could switch the player to a different sprite (for example, if the game had multiple playable characters), and the sprite would contain the appropriate collision polygons.

This is my line of thinking:
Generic Platform Object (contains local variables for the Player)
Family.PlayableCharacter (pinned to generic platform object)
-- Sprite CharacterX (contains bounding polygons)
-- Sprite CharacterY (contains bounding polygons)
-- Sprite CharacterZ (contains bounding polygons)

Doesn't that seem okay? Are there any downsides that I'm missing?

This is more of a design-level question, but I'm really fussy about keeping everything nice and hierarchical.

Thanks,
-- cacotigon
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Sat Jul 21, 2012 2:42 pm

Any advice? Plus with the addition of family behaviors and variables, I honestly can't think of a compelling reason to use an invisible shell sprite anymore as per the manual recommendation.

http://www.scirra.com/manual/100/platform
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Sat Jul 21, 2012 8:05 pm

B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Jul 21, 2012 8:55 pm

I'm sure there's a subtle message that I'm missing here. Also hanging from one's chin has to be fairly uncomfortable.
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Sun Jul 22, 2012 11:07 pm

Nah the hanging from the chin effect is the reason why you should use a rectangular sprite for collisions, and more or less how I discovered it (: (2 years ago)
You also need this rectangle for the platform logic. The collisions on animation are less stable. If you animate a run cycle, on some frame the feet shouldn't touch the ground. If they were to be used as collision you'd see some vertical wiggling.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 18 guests