The Daily Click ::. Forums ::. Klik Coding Help ::. moving chain?
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
6th June, 2009 at 01:15:25 -

anyone know how to make a moving chain for an arm for a boss? i want it to be a 3 segmented arm that follows the player, while remaining attached to each segment.

 
[Game design makes my brain feel like its gonna explode.]

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
6th June, 2009 at 01:32:43 -

Theres many ways to do it, some easy, and some more complicated, which create better visual effects.

The most basic is the 'linear' chain, which is basically a straight line. Create lets say 5 active objects that will make up the chain, call them "nodes". First we give each one a value telling which piece of the node it is:

Start of Frame:

Spread value 1 in "Node"'s alterable value A


Then you simply position each node along the ratio between the "Body" and "Arm", using the formula:
node = body + (arm - body) * (node value / # of nodes)
so we have:

Always:
Set Position X of "Node" to X("Body") + (X("Arm") - X("Body")) * (Value A("Node") / 5)
Set Position Y of "Node" to Y("Body") + (Y("Arm") - Y("Body")) * (Value A("Node") / 5)


now thats the simplest one. More complex chain effects can be created but require a good experience of math. The ones I personally use are Verlet & Bezier chains, which you can study from here:
http://en.wikipedia.org/wiki/Verlet_integration
which I used to create: http://create-games.com/download.asp?id=6889
and
http://en.wikipedia.org/wiki/Bézier_curve
which I used to create: http://create-games.com/download.asp?id=7507

that should help!

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
6th June, 2009 at 01:41:55 -

another cheap way to do it is with interlinking active objects.

have a long thin "chain" active object, with its hot spot at one end and active point at the other. Then, in your events, set the position of each node of the chain to the active point of the last one! You can now simply rotate the angle or animation angle of each node, however, its not often a very good looking effect, because its very complicated to know how to make them rotate. For an example of what that effect looks like, you can see it on the arms of the big purple last boss of one of my games in this video:
http://www.youtube.com/watch?v=xqjxR43JcrU#t=1m42s

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
6th June, 2009 at 01:56:17 -

hmmm both ways are extreamly confusing, i cant seem to get either to work correctly...

 
[Game design makes my brain feel like its gonna explode.]

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
6th June, 2009 at 01:57:50 -

which kind of effect are you looking to do.

do you want to connect the bosses arm to the body, but already have code that positions the arm, and just want a chain to be between them for graphics, or do you want the arm to swing out on the chain?

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
6th June, 2009 at 02:13:38 -

basically i want the arm of the boss to follow (theres a gun on the end) but i want each piece that gets closer to the body to move slower, so its not just a big moving board, but theres bending, and movement

 
[Game design makes my brain feel like its gonna explode.]

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
6th June, 2009 at 02:40:19 -

Try the "linear" one, the one with this:

Start of Frame:
Spread value 1 in "Node"'s alterable value A

Always:
Set Position X of "Node" to X("Body") + (X("Arm") - X("Body")) * (Value A("Node") / 5)
Set Position Y of "Node" to Y("Body") + (Y("Arm") - Y("Body")) * (Value A("Node") / 5)

Make sure that the HOT SPOT in the animation editor of your 'nodes' is in the direct middle of the object. Make sure the same thing for the "arm". And replace the X("Body") & Y("Body") with the action points of these, and put the action point where you want it to connect to the body

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
6th June, 2009 at 02:50:37 -

ok i kinda get it, but, what is the "arm"? isnt the arm made up of nodes? is there anything i need to do with the value A? is it supposed to be set to anything?

 
[Game design makes my brain feel like its gonna explode.]

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
6th June, 2009 at 03:02:13 -

I don't know why, but if this will help, then you can see this:

Which comes from a game I was making for the TDC Christmas Compo back in 2007.
http://sites.google.com/site/jlambsoft/Home/games/example.mfa
The source file is here. The boss has two parts to its body and two parts to each arm (three if you count the hand.)

Edited by an Administrator

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
6th June, 2009 at 20:40:15 -

hey jon, the vitalize thing doesnt work....

 
[Game design makes my brain feel like its gonna explode.]

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
6th June, 2009 at 22:41:23 -

I can make a nice little linear example in a bit if you'd like.

 

  		
  		

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
7th June, 2009 at 00:54:21 -


Originally Posted by siven
hey jon, the vitalize thing doesnt work....


It doesn't? Like how? It works on my end... I'll change the host then, and see if that works...

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
8th June, 2009 at 05:16:36 -

its says i need the plugin, which takes me to vitalize's site, but it wont install correctly, i dont think its your fault

 
[Game design makes my brain feel like its gonna explode.]
   

Post Reply



 



Advertisement

Worth A Click