Page 1 of 1

[Tutorial]: Following a rope

PostPosted: Wed Jan 25, 2012 2:31 am
by Hblade
What inspired me to make this tutorial was I was watching a lets play of Mischief Makers, and decided.. hey it'd be cool to have a rope effect. So I came up with an incredibly simple way.

First: Download this rope graphic
Rope.png



Now lets begin! :) Add your rope graphic like so:
SSSS1.png

Now click the Path button and make a new path with these specs: (120 frames for this example)
SSSS2.png


Now, click the starting piece of the rope
SSSS3.png


Click to create a new dot along the rope. The more dots you have the higher accuracy. If you have a rope with a ton of curves your gonna need a lot of dots. :3
SSSS4.png


Now finally, make the actor you want to follow on the rope.
SSSS5.png


Now your complete :D Click game and watch the actor follow the rope.

If you want to get even more advanced and have the actor fall off the rope, then you'd add an event - path finish -
Code: Select all
directional_velocity=10;
ChangePath("Event Actor", "(none)", BOTH_AXIS);

For accurate speed after stopping, use a calculator to determine the actual velocity he was going. Or you could save his directional velocity to a variable then use that. For example, have a variable called PATHON, and do an if statement in draw actor where if PATHON is equal to 0, (make a new variable called VAR1). VAR1=directional_velocity. Now after the path finish, you'd do PATHON=1; then do directional_velocity=VAR1 then the change path code. That should keep his velocity.

Example:
I used an array for this. Create a new variable, click "yes" to array, make it a size of 2. Name it v. Place this code in Draw Actor of the actor following the rope.
Code: Select all
if (v[0]==0)
{
    v[1]=directional_velocity;
}


Now at path finish:
Code: Select all
v[0]=0;
directional_velocity=v[1];
ChangePath("Event Actor", "(none)", BOTH_AXIS);

Hope this helps :)

Re: [Tutorial]: Following a rope

PostPosted: Wed Jan 25, 2012 11:14 pm
by CoFFiN6
Thanx man. I love picture tutorials :D

Re: [Tutorial]: Following a rope

PostPosted: Thu Jan 26, 2012 2:35 am
by Hblade
Thanks xD Coulda made a video one but I was to lazy.

Re: [Tutorial]: Following a rope

PostPosted: Thu Jan 26, 2012 4:15 am
by CoFFiN6
Most of the time I'm browsing GE on my phone and it no play no video .but its cool :D .its the code I'm after muahaha(evil laugh)

Re: [Tutorial]: Following a rope

PostPosted: Thu Jan 26, 2012 8:56 am
by Hblade
XD