The Daily Click ::. Forums ::. Klik Coding Help ::. Swing?
 

Post Reply  Post Oekaki 
 

Posted By Message

whowiseedet



Registered
  06/12/2008
Points
  2
6th December, 2008 at 17:31:20 -

I have been having trouble after trouble trying to create a swing. The kind I am looking to create is a vine that swings back and forth on its own. When my character "grabs" the vine, I want him to swing along at the same rate as the vine, and (this isn't necessary but would be a nice final touch)be able to jump off with inertia from his swing.

One of the biggest problems I am having is that when the player collides with the vine, the camera snaps jerkily when he is positioned at the swinging point. If I don't position him at this one point, however, he will grab any part of the vine and it won't look realistic.

Any suggestions?


 
n/a

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 December, 2008 at 17:48:03 -

Swinging is fun to try to figure out. With the camera, I'd say center it on a separate object rather than the character, that way you can manipulate the camera independently of the character. Or, depending on your setup, you may be able to just center the X of the camera on the character.

 

  		
  		

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
8th December, 2008 at 16:09:15 -

The idea of the swing is very simple, but the coding for what you want to do is a little more complicated. I don't know exactly how to do one (and not being at home, can't fool around in MMF), but I can offer some thoughts.

Scrolling problem: could be fixed if your scrolling were not fixed onto the actual active object that is your player. An idea would be, like OldManClayton suggested, using a camera active object that the scrolling is fixed on, which will "follow" the character, but not be being repositioned to his X and Y co-ordinates using an "Every.." or "Always.." event. It could be a moving ball type movement, so it can follow the character a little more smoothly.

The problem you will have with scrolling set on the character is that I'm assuming once he grabs the vine, he is pinned onto the vine snapping his X/Y onto the swinging point, so no matter what you do he WILL be jerked onto the vine if he is not in an exact position where his X/Y and the swinging point overlap perfectly, thus taking the camera with him, jumping those few or more pixels.

Jumping off swing: Again may have problems if the scrolling is locked onto him, because he may jerk/jump pixels as he comes off. That aside, with this being a platformer/side scroller, creating a trajectory effect is not too hard. It's having the values adjusted so that for one, it looks relatively realistic that the character is coming off the swing and secondly that it has decent inertia depending on when he decides to let go of the swing. I don't know how the more advanced coders would do this, the way I am thinking about it is probably a little more effort than need be or a round-about way of doing it, but most importantly are you using built-in MMF platform movement or are you using custom movement? (The solution would depend on this.)


 
n/a

whowiseedet



Registered
  06/12/2008
Points
  2
9th December, 2008 at 03:21:16 -

Custom movement, of course.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click