how do I create a scarf effect in a platform game

0 favourites
  • 15 posts
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • What I'm trying to achieve is the effect of a scarf trailing behind the player as they run and jump around the platform game, and have the scarf settle as the player stops moving. I could do this all with animation but I believe it will look much more dynamic done this way.

    I tried creating 3 scarf instances and pinning them to the playerbox (who has the platform behavior) with the "rope style" selected.

    The results were close to what I'm looking for but there were a few issues:

    1. The scarf sprites seem to stretch a bit too far from the player object as I move around. I'm looking to anchor the scarf to the player so that there is little to no stretching to create the illusion of a single scarf item that can flap around.

    2. The scarf sprites don't settle. Instead they kinda just float there waiting to be pulled by the player.

    I tried fooling with the platform and physics behaviors on the scarf sprite but I can't seem to come up with a solution.

    any suggestions, thoughts, comments?

    Here's my capx:

    dropbox.com/s/34e1nyl8t4vpl18/scarfTest.capx

  • I've tried the physics approach before using a physics rope as a base. I didn't quite get it to have the feel of a cape. I probably didn't tweak it enough though. If you lower the density of the pieces of rope and reduce the gravity it can look close to what you want.

    The only thing that's lacking is for it to catch wind. If the cape were in a complete vacuum it would probably act just like the rope. To do air resistance it might be enough to apply a force 100*sin(anglediff(link angle, angle of motion)) perpendicular to each piece of rope. I haven't tested that but it should simulate more resistance when the rope moves perpendicular to it's angle, and allow free motion when moving the same direction as it's angle.

    This is all a rough idea but hopefully give you some starting points of how to tackle it.

  • It definitely gives me a place to start. Would you care to elaborate how your links were being created in the code. I'm new to all of this and am still wrapping my head around the concepts.

    I see you have an anchor for the wheel objects to revolve around. I supose I could do something similar to anchor the links to the player.

  • Cloth simulation in C2

    Link

  • Chrisbrobs

    Hey thanx, this is another great example of how to approach this. Thanx for your time everyone. I'll try implementing these examples and see what i can come up with on my own.

  • Ok so after sometime playing with the examples both of you so generously posted in this forum I believe I've come up with a solution for the effect I'm trying to achieve. I'll post a link to my capx example when I go on lunch break from work :P

  • Once I got the basic concept down it was acutally pretty simple to do:

    dropbox.com/s/34e1nyl8t4vpl18/scarfTest.capx

    give it a shot and let me know if any of you know a cleaner/more stable way of handling this effect :)

  • It's good,

    you could do this with multiple instances of the same scarf object (instead of scarf1,scarf2 etc) and a loop, .. that way you could make it however long you wanted with the same events.. but if that's not a big deal, and if you don't mind the extra objects, then this is fine.

    also if you increase the linear damping, the scarf will trail more. It's basically air resistance.

  • Awesome! Yeah I tried my hand at looping from RoJo's exmaple, and ended up with a mess, lol. I'm still learning my way around, so I'll def give it another go.

    thanks! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I'm working on a different method. Should be finished in a bit.

  • Here's how I would do it.

    This method doesn't need to use physics, so it's a bit simpler. Also I added a scarf ripple and wind randomness - you'll just have to try it out

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • intersting! This way gives mush better control to the actual scarf images I have in my head, and the wind randomness is really awesome, thanks!

  • Hey guys, it has been a while, but with a bit of luck I will get an answer!

    Squiddster your model was extremely useful, but I have a small question. I didnt get the whole logic, and I would like to know if there is a way to add an external force on the scarf, as wind, typically, so when the player doesnt move, if there is wind, the scarf is moved.

    Hope you'll see that, thanks again !

  • Thankyou for this post.

  • The dropbox link has gone dead, if anyone has a mirror that would be appreciated.

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