Flixel Power Tools FlxControl

Back to the Flixel Power Tools

This class makes it painfully easy to quickly set-up controls for your game, and then it takes control over the motion and physics of your player sprite. Acceleration, deceleration, jumping, firing, gravity, cursor keys, WASD, IJKL, heck anything you like! It can cope with a lot. 2 players on the same keyboard? No problem, it’s just 2 lines of code!

It might seem strange to make a class for keyboard controls when Flixel makes it so easy anyway, but I promise this will save a lot of repeat code and maybe even add some features you always wanted?! :)

Screen Shot

Code Example

Recent Flixel Power Tool Posts

  1. Flixel Power Tools v1.9 Released
  2. Flixel Power Tools v1.8 Released - Let's get clicky
  3. Flixel Power Tools v1.7 - Kaboom!
  4. Flixel Power Tools v1.6 released including FlxControl
  5. Flixel Power Tools v1.5 - A monster of an update!
  6. FlxScreenGrab and FlxScrollZone added to Flixel Power Tools
  7. Flixel Power Tools v1.3 - Now Flixel 2.5 compatible!
  8. FlxHealthBar added to Flixel Power Tools

3 Responses

Leave a comment
  • Nejuf
    October 18th 2011 at 4:13 am

    The control handler seems to only take into account the bounds of the sprite when a movement key is being pressed. This means that if I have a sprite with acceleration/deceleration, when I push the sprite to the boundary and let go of the key, the sprite is freely allowed past the boundary and doesn’t return until I press a key again.

    If this is the intended behavior, it doesn’t seem to match the setBounds() description, “Limits the sprite to only be allowed within this rectangle. If its x/y coordinates go outside it will be repositioned back inside.”

    For my purposes, I’m going to have it check on update().

  • MC
    July 24th 2013 at 12:40 am

    How do you add extra keys?
    and how do you add extra functions to these keys?

Make yourself heard