Little Ninja Platform Engine: Running and sliding
Hellollo! Happy New Year everyone!
If you remember in our previous posts, I first defined the different actions states that the Ninja would have. First Little Ninja walked and jumped, and later he double-jumped, hanged on walls, and walked on cliffs. So, what’s left?
Running
Running is crucial in most fast-pased action games, and fairly easy to program. Basically, when the users taps the same direction twice and holds the button, the character will go from WALK -> RUN, which is essentially the same as walking except it’s a different animation, and the moves faster (x * 2, or twice is fast in our case):

If you watch carefully, jumping while running allows the Ninja to jump farther (again, twice as far as opposed to the normal jump), and if you hold the same direction he will keep on running after jumping. Another detail is that, if the Ninja runs for a little while and stops, instead of going from RUN -> WALK, his transition will be RUN -> BREAK -> WALK. Did you notice it? This small details polish the platform engine and will allow the Ninja to move swifter and smoother. He’s a stealth Ninja after all!
Ducking and sliding
Before thinking about sliding (dashing), for the last 30 years, most 2D platform games slide by holding the JUMP key while you’re holding DOWN — or ducking. Ducking was one of the states that I should have programmed firsthand, but since it had no particular use until now, I decided not to do it. You reap what you sow they say!
Anyway, life lesson aside, ducking is fairly simple: the character will start the DUCK animation and reach the DUCK state while you’re holding the DOWN key, but if you release it will start to un-DUCK (aka: stand up) and reach the IDLE animation.
Anyway, while Ninja·kun is ducking, pressing the JUMP key will allow him to SLIDE, useful for sneaking in small places, squishing wild frogs, etc. Take a look:

As you can see, Yuan decided that a simple Megaman 3 sliding “animation” was not enough, and decided to create a very funny animation that I thought would never work. Worked like a charm to my surprise. Anyway, eventually the Ninja will be able to slide while running and do some other fancy moves, but for now, enjoy the new video with all the new Ninja features:
That’s it for today, hope you enjoy it and don’t forget to subscribe to our content and follow our progress closely!




January 8th, 2009 at 12:33 pm
Waw !
I wish to know the programming logic behind such animation.
I mean is this something like a finite state machine or is there a robust framework for every animation ?
I would so much improve this in my game, animation is too erratic and cycle based
January 10th, 2009 at 8:56 am
Congratulations!!! I’m sure, this will be a great game when it’s finished. Do you planning to do this game playable in a pc ? or will be playable on dreamcast, gp2x only?
Congratulations again! =)
Sebastián García
PD: The slide animation, looks like Strider Hiryu sliding style, this is cool! =D
January 16th, 2009 at 5:35 am
Mucha suerte con este nuevo proyecto, ¡¡sois muy buenos!!
February 14th, 2009 at 8:42 pm
@ARme: It’s composed of FSM, but there is no robust framework. On some occasions, there are different animations for each enter-state/in-state/end-state. Transition animations are very important though
@Sebastian: It will be playable on PC, not sure if it will be released though. Depends on what you guys want
@josepzin: ¡Gracias! Los estaremos manteniendo al tanto en el foro de GP2X
May 14th, 2009 at 12:38 am
Great article. I believe that running is essential in weight loss!
March 7th, 2010 at 4:01 am
I’d love to see this finished and a comercial release for the Dreamcast! From what I’ve seen it’s shaping up nicely!