The Daily Click ::. Forums ::. Klik Coding Help ::. Swinging rope/chain?
 

Post Reply  Post Oekaki 
 

Posted By Message

Whatkin



Registered
  08/05/2004
Points
  7
30th June, 2004 at 16:28:33 -

I've been thinking and thinking, and I've come up with nothing. I have been setting up this game for a while. I'm making it so you can kill the enemy, (not too hard I realize lol) but you can also trap him first. Where a looped rope on the ground swipes his feet and he goes upside down and he's stuck, just sitting there. Just like in the movies/cartoons and whatnot.

I got everything working. (animated I mean) to where he can swing with all the directions the character could swing in. But I'm stumped as to how to make an actual rope move. Kinda sway, but when the characer comes up to it and pushes it it will sway in the direction he moved it in. Any ideas?

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
30th June, 2004 at 20:02:05 -

I'm not really sure how you have coded this, but if you are using directions then you could use this piece of code:

Player collides with rope - Set rope direction to player direction. (Using Expression Calculator)

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Whatkin



Registered
  08/05/2004
Points
  7
1st July, 2004 at 10:08:41 -

Thanks I'll try that.

 
n/a

Blackstorm



Registered
  29/08/2002
Points
  439
1st July, 2004 at 11:19:52 -

Okay... I haven't actually tried this myself, but I'm assuming it works...

First, set how much X position you want it to move by changing Alterable Value C.

>Start of Frame
->Set Alterable Value C (Rope) to 5

Now, set how much Y position you want it to move with Alterable Value D.

>Start of Frame
->Set Alterable Value D (Rope) to 3

Now that you have those, you need the actual swinging part. To make it go back and forth, you need this...

>Always
->Set X position (Rope) to X(rope) + Alterable Value A (Rope)

Ok, another part of making the rope move...

>Always
>Internal Flag 0 (Rope) is on (I'll explain the flag later)
->Add 1 to Alterable Value A (Rope)

And this part's sister coding...

>Always
>Internal Flag 0 (Rope) is off
->Subtract 1 from Alterable Value A (Rope)

Alright, now we need to make it switch directions.

>Alterable Value A (Rope)= Alterable Value C (Rope)
->Set Internal Flag 0 off

And this part's cousin... (We're getting a family here!)

>Alterable Value A (Rope)= Alterable Value A (Rope) - Alterable Value C (Rope)*2
->Set Internal Flag 0 (Rope) on

Going off of the X position part, you should be able to get the Y position, because they are pretty much the same.

Now, you need two things. An object at the Rope's Connection Point, (Should be wherever you want the rope to come down from) amd the Drawline object. Make the Drawline draw a line between the Connection Point and the Rope Point. I haven't used Drawline for a long time, so I don't know what the code looks like.

Anyway, a good thing about the Alterable Value C and D is that you can make random lengths of rope with it.

>Start of Frame
->Set Alterable Value C (Rope) to 3 + Random (5)
->Set Alterable Value D (Rope) to 2 + Random (3)

If you find out what sort of number is required for Alterable Value D to make the animation look better, just make it so that this happens...

>Timer is equal to 1:00 (1 second)
->Set Alterable Value D (Rope) to Alterable Value C (Rope) / 2

I hope you can understand this. Cya!

 
Wise sayings:
"A pint of example is worth a gallon of advice."
"Do unto others as you want done unto you."
"An idea is nothing without effort."
"HOLY CRAP!"

Whatkin



Registered
  08/05/2004
Points
  7
2nd July, 2004 at 16:40:52 -

hey I got the drawline extension, not a clue what to do with it, or what any of it does... lol know of any good tutorials on it? so I can learn and hopefully use it to get this working. So far I got all that other stuff set up. (doing it in tgf so I changed the D value you had to B I think. Should work just the same.)

I think I understand most of that, other than the drawline portion. so I guess until that's set up... it wont do much good. I do appreciate the help a lot though. Just need to figure out what I'm supposed to do with drawline...

 
n/a

AsparagusTrevor

Mine's a pint of the black stuff

Registered
  20/08/2002
Points
  2364

Game of the Week WinnerHas Donated, Thank You!VIP MemberEvil kliker
2nd July, 2004 at 19:03:32 -

Only trouble is Drawline's buggier than a buggy bug in a bug convention in Bugsville, New Mexico. Especially when using a scrolling screen.

 
Image

Blackstorm



Registered
  29/08/2002
Points
  439
2nd July, 2004 at 20:40:42 -

Well, the only bug I know of is the one where it pastes itself into the background... Merely make an active object that has the same color/design as what you want your background to be, and have it paste itself into the background.

 
Wise sayings:
"A pint of example is worth a gallon of advice."
"Do unto others as you want done unto you."
"An idea is nothing without effort."
"HOLY CRAP!"

Whatkin



Registered
  08/05/2004
Points
  7
3rd July, 2004 at 13:39:58 -

so no tutorials on what it does or how to use it? lol.

 
n/a

Blackstorm



Registered
  29/08/2002
Points
  439
4th July, 2004 at 18:46:00 -

I just posted a swinging rope tutorial in the downloads section. That should work fine, except that it uses drawline.

 
Wise sayings:
"A pint of example is worth a gallon of advice."
"Do unto others as you want done unto you."
"An idea is nothing without effort."
"HOLY CRAP!"

AsparagusTrevor

Mine's a pint of the black stuff

Registered
  20/08/2002
Points
  2364

Game of the Week WinnerHas Donated, Thank You!VIP MemberEvil kliker
4th July, 2004 at 21:32:03 -

It's a bit cack though.

 
Image

Blackstorm



Registered
  29/08/2002
Points
  439
5th July, 2004 at 12:05:09 -

That should work fine, EXCEPT THAT IT USES DRAWLINE.

 
Wise sayings:
"A pint of example is worth a gallon of advice."
"Do unto others as you want done unto you."
"An idea is nothing without effort."
"HOLY CRAP!"
   

Post Reply



 



Advertisement

Worth A Click