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

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
  • August 27th 2011 at 11:51 am

    Hello, I’m trying to create an auto aim with FlxVelocity, but my sprites are missiles and not round objects, how would you suggest that I do this with the missiles rotating accordingly, (going left/right, or downwards) my shooter has a fixed position and the targets move top to bottom.

    Thanks in advance!

Make yourself heard