Tuesday, September 04, 2012

Smooth Slopes at last!

After so many tests where I had to jump slightly when approaching the bottom of a slope, having flawless, smooth moves in the school zone almost feel magic!

Funny enough, the doslopes() function that I crafted carefully was already flawless, but the defects were in the glu code (the walker controller) that interfaces that with the animation replay. As I expected from the start, the step-by-step movements system was the root of the problem. It essentially nailed down to 2 things, that occured when leaving a slope:

  1. in that case, I need to check whether the character could fall. Bug #1 was that I wasn't completely taking care of the horizontal adjustment in that case, and it resulted in "no, you won't fall at coordinates (99,60). you can safely move and stand at (100,60)"
  2. when falling down, the controller actually FAILs to keep walking, but that means (for the animation replay subsystem) that the defined speeds are cancelled. The problem is in the case of walking off a cliff, the horizontal move has been validated and it should *not* be cancelled. Only the absence of vertical move changes.


I updated the demo link accordingly in the "back to school" post ^_^

2 comments:

PypeBros said...

I'm sure you've noticed that strange pause Bilou makes when he lands on the top of the binder. I think I've got an explanation for that (at last): the engine insists on finishing the "jump/fall" transition while the states have changed.

PypeBros said...

There's something subtle going on with those fall/walk transitions: it involves actually fall/idle/walk with a special action during fall/idle that makes idle believe the keypress on DPAD direction is "new" and immediately trigger an event.

Another item: iirc, walk cannot show a first image immediately: there is a MOVE statement ahead of the animation list. Should we skip it when entering the state ?