Consistent collision boxes?

  • 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.


    -- cacotigon

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • <img src="" border="0" />

  • I'm sure there's a subtle message that I'm missing here. Also hanging from one's chin has to be fairly uncomfortable.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)