Flixel Power Tools FlxVelocity

Back to the Flixel Power Tools

A class to help with setting and using the velocity of FlxSprites. With this you can move one sprite towards another, move a sprite towards the mouse, get distances between sprites / mouse and get angles between sprites and the mouse.

It doesn’t sound very exciting (and it’s not to look at) but they can start to save you real time, and keep your code tidy and clean.

Currently supports the following methods:

  • moveTowardsObject
  • accelerateTowardsObject
  • moveTowardsMouse
  • accelerateTowardsMouse
  • moveTowardsPoint
  • accelerateTowardsPoint
  • distanceBetween
  • distanceToPoint
  • distanceToMouse
  • angleBetweenPoint
  • angleBetween
  • velocityFromAngle
  • angleBetweenMouse

Screen Shot

Code Example


// Move the blue ball towards green at a speed of 180 pixels per second
FlxVelocity.moveTowardsObject(blue, green, 180);

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

One Response

Leave a comment

Make yourself heard