Problem with an animated ball

Started by rbaleksandar, Mon 06/09/2010 20:41:49

Previous topic - Next topic

rbaleksandar

Hallo, guys.

  Right now I'm making a small test-environment for a bigger project of mine. The character that I use here is a small red rubber ball. I have 4 views (default) - up, down, left and right. I didn't want to make the animation too detailed (for now) so I made only 12 frames per view (including the standing-frame (the first one that is)). The problem is that jumping isn't like rolling, walking or swimming. The ball jumps into the air, flies a certain distance and than lands. When walking for example, the character has a constant contact with the surface (land). So no matter how small the distance is that he (the character) has to walk it never looks dull when you suddenly stop him or there isn't enough space anymore where he can continue walking. It's a totally different story with a jumping object. When you decide to stop the current jump, the ball is in mid-air and it suddenly changes from the mid-air-frame (Nth frame in the current view) to the standing-frame (1st frame). The same goes when there is not enough space to continue the short flight and the ball "falls" in a quite dull-looking way on the ground.
  My question is: how can I make the ball make a full jump no matter the distance it has to jump and is it possible to make this just with the views-manager or one has to script it?
  Example: the ball can make a jump of maximum 1 meter. You click on a point that is 1.5 meters aways from where the ball's standing. Now in my case it makes a 1 meter jump and than a half-jump for the remaining 0.5 meter. Much more realistic is when the ball makes 2 jumps 0.75 meters each.
  I was thinking of making some kind of a script that calculates the distance to the destination and divides it in equal segments. Than do the jumps. The problem is (besides the fact that I still can't figure out how to "use" the views-manager inside a script) that even than if I stop the current jump with a mouse click, the same thing will still happen.


Much obliged for any solution.  :)
I am a mighty pirate. Arrrrgh!

Khris

This is going to be complex. I once made a small test game where the character would stop when he reached one of the two walking frames in between steps if the distance to the target was small enough (like Broken Sword).
With a ball that's supposed to jump arbitrary lengths, probably being deformed a bit during the bounce, it's gonna get even more complex.
The biggest problem here is the pathfinder, or rather the limited scripting access to it. The only solution I can think of is to use an invisible dummy character that's going to do the actual walking while the ball follows their path.

This is definitely not possible using only the view manager.

How complex are the walkable areas going to be?

rbaleksandar

Hi and thanks for the fast reply!

  The walkable areas won't be complex. Most of them will be straight-forward-walking. The ball changes it's shape and angle. There are 3 stages in my jump: #1# before it jumps or when it hits the ground after a jump the ball becomes a little bit flat (ellipse) to give the impression it gains "power" in order to jump or that it has hit the ground; #2# when flying up or falling it changes its form (from round to elliptic) and accordingly - the angle too; #3# the top most part of the jump, when the ball "floats".
  As for the dummy do you mean something like this: the dummy reaches the end of a walkable area or the player decides to cancel the current jump and "sends a signal" to the original character what has happened in order to change its movement. The dummy has to have one jump in advance that is - the character is about to make jump X and the dummy is about to make jump X+1? I hope I get the idea... :D
I am a mighty pirate. Arrrrgh!

SMF spam blocked by CleanTalk