Flixel Power Tools FlxWeapon
FlxWeapon is a comprehensive weapon manager for any game that involves shooting! It handles the creation, pooling and re-use of bullets. It supports:
- Angled Bullets
- Bullet Velocity and Acceleration
- Fire at the Mouse
- Fire from the Mouse
- Fire from a parent Sprite
- Fire at a target Sprite
- Fire from a fixed position
- Fire to a fixed position
- Set the firing rate (in real-time)
- Bullet Gravity (!)
Use it FlxControl for a really powerful combo. Weapons can be stacked onto a single player, so there’s no reason they couldn’t be firing several of them at the same time.
// Our players space ship
player = new FlxSprite(160, 200, AssetsRegistry.invaderPNG);
// Creates our weapon. We'll call it "lazer" and link it to the x/y coordinates of the player sprite
lazer = new FlxWeapon("lazer", player, "x", "y");
// Tell the weapon to create 50 bullets using the bulletPNG image.
// The 5 value is the x offset, which makes the bullet fire from the tip of the players ship.
lazer.makeImageBullet(50, AssetsRegistry.bulletPNG, 5);
// Sets the direction and speed the bullets will be fired in
Recent Flixel Power Tool Posts
- Flixel Power Tools v1.9 Released
- Flixel Power Tools v1.8 Released - Let's get clicky
- Flixel Power Tools v1.7 - Kaboom!
- Flixel Power Tools v1.6 released including FlxControl
- Flixel Power Tools v1.5 - A monster of an update!
- FlxScreenGrab and FlxScrollZone added to Flixel Power Tools
- Flixel Power Tools v1.3 - Now Flixel 2.5 compatible!
- FlxHealthBar added to Flixel Power Tools
9 ResponsesLeave a comment
Make yourself heard
All about Photon Storm and our
HTML5 game development services
Filter our Content
- Cool Links
- Flash Game Dev Tips
- Game Development
- Geek Shopping
- In the Media
- Phaser 3