Sprite Collision - Platformers

This forum is currently in read-only mode.
From the Asset Store
Particles support animations, collisions, effects and etc.
  • I'm playing around with a platformer starring a wolf, and may have just realized why most platformers use two-legged characters.

    If the player is standing on the edge of a ledge, then you have issues with overhanging feet, such as this image of Charlie from Deadeye's tutorials:

    <img src="http://i216.photobucket.com/albums/cc212/darkstorne/Temp22012-01-0913-29-26-32.jpg" border="0" />

    Presumably, this isn't too difficult to fix, since you could use specific animations to bring feet together, or leave one visibly dangling, when the player is close to a ledge's edge:

    <img src="http://www.ukresistance.co.uk/pics7/sonic_2_crop.jpg" border="0" />

    <img src="http://www.ukresistance.co.uk/pics5/sonic-2-hd-remake-2.jpg" border="0" />

    But I'm struggling to think of ways to address this issue with a four-legged animal. He's so long that the 'edge' detection would have to be pretty huge, and switching him to a balancing animation would probably lead to odd teleportations of the sprite - bringing him closer to the edge than he really is, just because his front legs are close enough. Having no balancing animations at all could easily lead to 90% of his length, and three of his four legs, seeming to stand on thin air, just because one of his paws is still on a platform...

    <img src="http://i216.photobucket.com/albums/cc212/darkstorne/Wolf.png" border="0" />

    Any suggestions?

  • Hmmm..How about this?

    -If far over the ledge: Automatically walk off or do some downwards hop.

    -If barely over the ledge: Automatically walk backwards until all four legs are on the platform.

  • I've been thinking about the downwards hop thing too. Trouble is it all depends on what frame the animation is at. So in the image above, if the wolf was right at the edge of a platform with his hind legs being the only part still touching it - that looks and works fine - so a downward hop wouldn't be necessary.

    If, on the other hand, the animation frame was of his front legs landing at that stage, then he would look to be a good meter over the edge of the platform, and the downwards hop would be overdue.

    Sticking that downwards hop requirement to the center of the sprite would be a trade-off of sorts, but could then easily lead to times when it looks slightly overdue (front legs slightly over the platform mid-run - with hind legs still in the air), or it could force the player to drop too early since his forlegs might be in the air and his hind legs a good half meter before the edge.

    In a platformer, it seems pretty important to get these edge detections spot on. Being forced to drop down too early could be infuriating for players.

  • I don't see such a big problem.

    If You did the jumping animation of the wolf close to its real jumping behaviour in life, the two front legs should be reaching forward, with the back legs spread to the back (in mid-air). And when he is landing, he should be landing with his two front legs first, and as they are touching the ground, the two back legs would come forward and probably touch the ground close to the front paws (slightly behind or in front of). Then the front legs make a slight step forward again, to ease out the body.

    (Just google "wolf jumping" to see what I mean.)

    So basically this should be able to look pretty natural, if You mimick its real moving behaviour.

    Of course depending on which angle he is jumping from, say from below, or from above onto the surface, You'd have to change the angle of the animation a little.

    For example, if I had the full animation, as I described above, I would generaly do it like this:

    Let's assume the mid-air sprite is 100px wide. And the hotspot (for determining its position) is in the middle of the sprite. I roughly guess the size of the paws as 10px now, so the sprite needs to be on the surface with at least 10 px, to move onto it.

    Assuming You're jumping from the left:

    If Wolf is Jumping AND If Mid-AirAnimation is playing AND If Wolf.Left + 90(px) Equal or Greater than PlatformSprite.Left AND Wolf.Bottom Collides with PlatformSprite.Top -> Play LandingAnimation; Move Wolf.X with about 90px. (because body is easing out in animation and taking a step forward for landing)

    Of course You would have to slightly adjust it for different jumping angles, like I mentioned before. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • most games don't have that type of accuracy when lining up animations going from one animation to another. most 2d games instantly begin the jumping/slipping/tooCloseToEdge animation regardless of the point in the running animation they are in.

    One exception is Prince of Persia, which ends up having a very different feel. A wolf should feel free, not stuck to a grid like prince of persia, and no player will be able to predict where in their wolves run they'll be when they reach an edge, and games are more fun when you can control them.   

    That being said, I do think it's worth it to take the time to make animations blend smoothly into eachother, if that's something you decide you want to do. but I think the animation should work around the gameplay, not the other way around. for example, it would be better to have an alternate stopping-near-the-edge animation that starts from a different foot, rather than the same jump or near fall on the edge would have a different outcome depending on the positions of the legs in the animation.

    Most of my personal projects in the past year or so have been experiments dealing with animation blending(albeit using bones, and specialized plugins), so it's an area of particular interest to me.   

    Also, I like the wolf sprite you have there. is that your own art? if so, would you mind linking an animated gif, or your da page?

  • Could you not make the legs go together, in a sort of squat? Here's sort of what I mean:

    <img src="http://travel.sulekha.com/russia/photos/russia-114.jpg" border="0" />

    Alternatively you could do something like this:

    <img src="http://icanhascheezburger.files.wordpress.com/2011/01/funny-pictures-gif-cat-stand-squat.gif" border="0" />

  • <img src="http://icanhascheezburger.files.wordpress.com/2011/01/funny-pictures-gif-cat-stand-squat.gif" border="0" />

    Oh my gosh, Garfield lives! <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Not sure how to use a multi-quote feature on this forum...

    @Shindoh - You're right in everything you say. It's probably something I'll need to play around with. I just panicked when I started working on the running animation, wondering if I'm going to run in issues with this.

    But yes, a wolf's paws all land in roughly the same spot. The issue I'll have is that the sprite's hotspot isn't going to be matched up to the wolf's... center of gravity? IE: When he's jumping up, his paws and attachment to the platform are at his rear, like in my original sprite above. But when he lands, his paws are at his front (image below). The hotspot, and the only thing the engine really cares about, will always be at the center of the sprite though. The player will be judging by the wolf's feet.

    But as you say, it may well be something I can find the right balance for. And I plan on creating a lot of animations to make it look and feel right. So long as it CAN be done, I'll try my best to do it :)

    <img src="http://i216.photobucket.com/albums/cc212/darkstorne/landing.png" border="0" />

    @Lucid - It is my own artwork, thanks for the compliment :) And yes, I plan on creating a lot of animations for this, and agree that a different stopping animation depending on the current animation frame would be important. I don't see any issues with getting that to work. I also want a climbing animation, for when the wolf is only just hitting the right height to climb up to a higher platform, which I have plenty of ideas for creating. The only part that scares me is the jumping animation. Naturally a wolf jumps from his hind legs of course, so I'm not sure how to handle a jump command being issued when the wolf is on his front legs, or mid-air in his run cycle. Jumping back to a hind leg frame could look jarring...

    But that's something I'll tackle at a later date. For now I'm working on the run animation. I plan on completing 8 main frames, and editing them in Anime Studio to blend them together nicely. I don't have much experience in that program yet aside from animating trees, but if it's a subject you enjoy then I'd love some feedback from you when I've completed my first pass at the wolf's run cycle.

    So far, I've done 6 of the 8 main frames, and should be done by the weekend. I'll post an animated image then :)

    @Tom - That's something I have in mind, yes, but I'm worried about... teleportation, for lack of a better word. It's such a long sprite when he's standing that on small platforms he'll pretty much always have one of his paws close to a ledge. I'd have to find a way to balance it, but I can imagine it looking strange if the wolf is triggered as being close enough to the left edge to pull him back to a squatting animation on the left ledge, and after half a meter of walking forwards he's triggered as having his front paws close enough to pull him forward into a squatting animation on the right ledge.

    I guess the easy way out is to only have long platforms =P

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