Flixel Power Tools FlxWeapon
Back to the Flixel Power Tools
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
- Sounds
- Callbacks
- 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.
Screen Shot
Code Example
// 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
lazer.setBulletDirection(FlxWeapon.BULLET_UP, 200);
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
Make yourself heard
FPT Classes
Hire Us
All about Photon Storm and our
HTML5 game development services
Recent Posts
OurGames
Filter our Content
- ActionScript3
- Art
- Cool Links
- Demoscene
- Flash Game Dev Tips
- Game Development
- Gaming
- Geek Shopping
- HTML5
- In the Media
- Phaser
- Phaser 3
- Projects
Brain Food