<commit_before>/**
 * FlxWeapon
 * -- Part of the Flixel Power Tools set
 * 
 * v1.3 Added bullet elasticity and bulletsFired counter
 * v1.2 Added useParentDirection boolean
 * v1.1 Added pre-fire, fire and post-fire callbacks and sound support, rnd factors, boolean returns and currentBullet
 * v1.0 First release
 * 
 * @version 1.3 - October 9th 2011
 * @link http://www.photonstorm.com
 * @link http://www.haxeflixel.com
 * @author <NAME> / Photon Storm
* @author Touch added by Impaler / Beeblerox
*/

package org.flixel.plugin.photonstorm;

import org.flixel.FlxBasic;
import org.flixel.FlxG;
import org.flixel.FlxTilemap;
import org.flixel.system.input.FlxTouch;
import nme.display.Bitmap;
import nme.display.BitmapInt32;
import org.flixel.FlxGroup;
import org.flixel.FlxObject;
import org.flixel.FlxPoint;
import org.flixel.FlxRect;
import org.flixel.FlxSound;
import org.flixel.FlxSprite;
import org.flixel.FlxU;
import org.flixel.plugin.photonstorm.baseTypes.Bullet;
import org.flixel.plugin.photonstorm.FlxVelocity;

/**
 * A Weapon can only fire 1 type of bullet. But it can fire many of them at once (in different directions if needed) via createBulletPattern
 * A Player could fire multiple Weapons at the same time however, if you need to layer them up
 * 
 * TODO
 * ----
 * 
 * Angled bullets
 * Baked Rotation support for angled bullets
 * Bullet death styles (particle effects)
 * Bullet trails - blur FX style and Missile Command "draw lines" style? (could be another FX plugin)
 * Homing Missiles
 * Bullet uses random sprite from sprite sheet (for rainbow style bullets), or cycles through them in sequence?
 * Some Weapon base classes like shotgun, lazer, etc?
 */

class FlxWeapon 
{
	/**
	 * Internal name for this weapon (i.e. "pulse rifle")
	 */
	public var name:String;
	
	/**
	 * The FlxGroup into which all the bullets for this weapon are drawn. This should be added to your display and collision checked against it.
	 */
	public var group:FlxGroup;
	
	//	Bullet values
	public var bounds:FlxRect;
	
	private var bulletSpeed:Int;
	private var rotateToAngle:Bool;
	
	//	When firing from a fixed position (i.e. Missile Command)
	private var fireFromPosition:Bool;
	private var fireX:Int;
	private var fireY:Int;
	
	private var lastFired:Int;
	private var nextFire:Int;
	private var fireRate:Int;<commit_msg>WIP on dev: d555703 Merge branch 'dev' of https://github.com/Beeblerox/HaxeFlixel into dev<commit_after>/**
 * FlxWeapon
 * -- Part of the Flixel Power Tools set
 * 
 * v1.3 Added bullet elasticity and bulletsFired counter
 * v1.2 Added useParentDirection boolean
 * v1.1 Added pre-fire, fire and post-fire callbacks and sound support, rnd factors, boolean returns and currentBullet
 * v1.0 First release
 * 
 * @version 1.3 - October 9th 2011
 * @link http://www.photonstorm.com
 * @link http://www.haxeflixel.com
 * @author <NAME> / Photon Storm
* @author Touch added by Impaler / Beeblerox
*/

package org.flixel.plugin.photonstorm;

import org.flixel.FlxBasic;
import org.flixel.FlxG;
import org.flixel.FlxTilemap;
import org.flixel.system.input.FlxTouch;
import nme.display.Bitmap;
import nme.display.BitmapInt32;
import org.flixel.FlxGroup;
import org.flixel.FlxObject;
import org.flixel.FlxPoint;
import org.flixel.FlxRect;
import org.flixel.FlxSound;
import org.flixel.FlxSprite;
import org.flixel.FlxU;
import org.flixel.plugin.photonstorm.baseTypes.Bullet;
import org.flixel.plugin.photonstorm.FlxVelocity;

/**
 * A Weapon can only fire 1 type of bullet. But it can fire many of them at once (in different directions if needed) via createBulletPattern
 * A Player could fire multiple Weapons at the same time however, if you need to layer them up
 * 
 * TODO
 * ----
 * 
 * Angled bullets
 * Baked Rotation support for angled bullets
 * Bullet death styles (particle effects)
 * Bullet trails - blur FX style and Missile Command "draw lines" style? (could be another FX plugin)
 * Homing Missiles
 * Bullet uses random sprite from sprite sheet (for rainbow style bullets), or cycles through them in sequence?
 * Some Weapon base classes like shotgun, lazer, etc?
 */

class FlxWeapon 
{
	/**
	 * Internal name for this weapon (i.e. "pulse rifle")
	 */
	public var name:String;
	
	/**
	 * The FlxGroup into which all the bullets for this weapon are drawn. This should be added to your display and collision checked against it.
	 */
	public var group:FlxGroup;
	
	// Internal variables, use with caution
	public var nextFire:Int;
	public var fireRate:Int;
	public var bulletSpeed:Int;
	
	//	Bullet values
	public var bounds:FlxRect;
	
	private var rotateToAngle:Bool;
	
	//	When firing from a fixed position (i.e. Missile Command)
	private var fireFromPosition:Bool;
	private var fireX:Int;
	private var fireY:Int;
	
	private var lastFired:Int;
{'fraction_non_alphanumeric': 0.08644811025266236, 'fraction_numerical': 0.008770098141574442, 'mean_word_length': 4.026232948583421, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7312435', 'n_tokens_mistral': 1586, 'n_tokens_neox': 1470, 'n_words': 550}