how do I create a scarf effect in a platform game

Get help using Construct 2

Post » Fri Nov 02, 2012 3:59 am

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:

https://www.dropbox.com/s/34e1nyl8t4vpl18/scarfTest.capx
...and artistic hocus pocus that will leave you up in smoke!
B
11
S
1
Posts: 12
Reputation: 1,881

Post » Fri Nov 02, 2012 5:53 am

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.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Fri Nov 02, 2012 7:14 am

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.
...and artistic hocus pocus that will leave you up in smoke!
B
11
S
1
Posts: 12
Reputation: 1,881

Post » Fri Nov 02, 2012 12:15 pm

Cloth simulation in C2

Link
B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300

Post » Fri Nov 02, 2012 1:42 pm

@ 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.
...and artistic hocus pocus that will leave you up in smoke!
B
11
S
1
Posts: 12
Reputation: 1,881

Post » Fri Nov 02, 2012 3:22 pm

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
...and artistic hocus pocus that will leave you up in smoke!
B
11
S
1
Posts: 12
Reputation: 1,881

Post » Fri Nov 02, 2012 5:29 pm

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

https://www.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 :)
...and artistic hocus pocus that will leave you up in smoke!
B
11
S
1
Posts: 12
Reputation: 1,881

Post » Fri Nov 02, 2012 11:22 pm

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.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Fri Nov 02, 2012 11:47 pm

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!
...and artistic hocus pocus that will leave you up in smoke!
B
11
S
1
Posts: 12
Reputation: 1,881

Post » Sat Nov 03, 2012 12:01 am

I'm working on a different method. Should be finished in a bit.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Next

Return to How do I....?

Who is online

Users browsing this forum: spcsmrf and 28 guests