Flixel Power Tools v1.6 released including FlxControl

I’m really  happy to have finally pushed v1.6 of the Flixel Power Tools from dev to master! The major new class is FlxControl. On the surface it may seem a bit pointless, after-all keyboard controls in Flixel are dead easy, right? But it actually wraps those up with the FlxSprite motion and physics. This means you just tell it how many pixels/second you want the sprite to move, and it’ll do the rest! Maximum velocity, acceleration, deceleration, gravity, firing, jumping and flipping all supported. There are 5 new Test Suite examples showing how to use FlxControl, including a platformer demo (the screen shot below), a 2-player on the same keyboard demo and a simple space invaders game.

I’m particularly happy about one feature in FlxControl – the ability for a “fall jump” timer. In Mario games there is a very short period of time in which you can still jump even if you’ve just fallen off the end of a platform. FlxControl lets you set that value, so your game can feature it too! You can experience it in the Control Test 2 demo. The little chick sprite can fall-jump, giving him much greater air control. Of course, it’s optional.

Also updated was FlxScrollZone with a new feature that made it work better with images containing alpha data. Finally a new Special FX Plugin – DropDown, which creates a nice way of revealing a title page or other in-game element.

As usual grab it from github or click any screen shot to see the full Flixel Power Tools page.

Posted on May 18th 2011 at 2:00 am by .
View more posts in Flixel Power Tools. Follow responses via the RSS 2.0 feed.


10 Responses

Leave a comment
  • superdeformed
    May 18th 2011 at 9:10 pm

    so awesome! would love to have this for mouse control too, although i’ve been using your velocity#1 for a “click and make sprite move here” control thingie for mobile.

  • May 18th 2011 at 10:20 pm

    What sort of commands would you like in a Mouse equivalent? (I’m having trouble thinking of many!)

  • superdeformed
    May 18th 2011 at 10:58 pm

    The same sort of player control, (with/without acceleration, etc, click to fire bullets or jump, etc), but using dragging or tapping so you could apply these awesome classes with built-in physics for mobile game development.

  • loz220
    May 18th 2011 at 10:58 pm

    nice! I’m really digging the Controls. One thing I noticed is that the jump should be changed from a pressed to a justPressed otherwise the player will continue jumping when you hold down the space key which Is not typical for platformers.

    Also, in the top down example I do believe when you move diagonally you’re actually moving at 1.4x of your intended velocity. I think you need to times x,y velocities by 0.707 or cos/sin(45) during such movement.

    Anyways, thanks for these and keep it up 😀

  • May 18th 2011 at 11:20 pm

    superdeformed – ok, I’ll add it to the todo list! At the moment I’m making ExtendedSprites which can be dragged around with the mouse, thrown, etc. So it’s a natural move from that.

    lox220 – You can set the KEYMODE for the jump button to whatever you like (PRESSED, JUST_PRESSED, JUST_RELEASED) :) and if you do have it set to pressed you can change the delay between jumps. The diagonal move is a good point, that’s basically how flixel works internally – but I’m tempted to add a parameter that will ease off the velocity for you as it’s a nice idea!

  • superdeformed
    May 18th 2011 at 11:37 pm

    ah, ExtendedSprites…nice. Not sure how you have all the energy for this…..I would be glad to contribute to a beer fund if that’s your secret :-)

  • loz220
    May 18th 2011 at 11:57 pm

    Ah, that’s awesome.

    As for the diagonal movement, I’d argue that its not flixel’s responsibility to cap the velocities, so internally it’s doing the right thing. IMO, it’s a bug in the FlxControls, player should not be moving faster diagonally than in other directions.

    That aside, I think its great to have keyboard movement handled via its own component.

  • May 19th 2011 at 12:12 am

    superdeformed – I’ve got fully draggable sprites working. It’ll be up on github dev tonight.

    loz220 – I’ll add it as an extra parameter. Technically it’s doing what it should at the moment (i.e. moving x/y by the amount you asked) but it does need it, I agree. I need to add the thrust / angle based movement to FlxControl anyway, so can do it with that.

  • superdeformed
    May 24th 2011 at 9:16 pm

    thanks, richard…i had d/led earlier, but had to add this line to your TestSuiteState.as to see the demo:

    options.push( { state: ExtendedSpriteTest1, color: [0xff8000FF, 0xffBE7DFF] } );

    one thing i see is that if you drag one ball over another, then release…..next time you try to move the “ball on top” you now move both balls (both of them being under the mouse). do i need to do some z-index sorting to prevent that, or is there an easier way?

    Thanks for this!

  • May 24th 2011 at 10:15 pm

    Good question. I don’t have an answer right now but have added it to the list, so keep an eye on my git commits as I’ll resolve it shortly!

Make yourself heard