"use strict";
// dummy object for visual effects
// dx and dy are in 1/8 units
var GO_FakeBullet = function(dx,dy,spriteSheet,frame,lifespan,collision){
	spriteSheet = spriteSheet ? spriteSheet : GO_FakeBullet.spriteSheet;
	frame = frame ? frame : 0;
	lifespan = lifespan ? lifespan : 30;
	collision = collision ? collision : 0;
	this.sprite = new Sprite(spriteSheet,"FakeBullet");
	this.sprite.collision_flags = collision;
	//this.sprite.setBoundingBox(
	//	2,
	//	2,
	//	5,
	//	5);
	// box will auto from tile size
	
	this.sprite.frame = frame;

	//sprite.constraints=constraints;
	this.sprite.max_step = 0;
	this.sprite.game_object = this; // no longer a generic GO

	this.dx = dx;
	this.dy = dy;
	this.dx_accum = 0;
	this.dy_accum = 0;

	this.lifespan = lifespan;
};
GO_FakeBullet.spriteImg = SDS_Load_Image("art/sheets/sprite/bullet1.png");
GO_FakeBullet.spriteSheet = new TileSheet(3, 3, 2, 0, GO_FakeBullet.spriteImg);

GO_FakeBullet.prototype = new GameObject(
	new Sprite(
		GO_FakeBullet.spriteSheet,
		"FakeBullet"
	),
	"FakeBullet"
	);

	GO_FakeBullet.prototype.interactions = 0;

	GO_FakeBullet.prototype.Update = function(){
		this.dx_accum+=this.dx;
		this.dy_accum+=this.dy;

		this._heap.dx = this.dx_accum>>3;
		this._heap.dy = this.dy_accum>>3;

		this.dx_accum &= 7;
		this.dy_accum &= 7;

		this.sprite.move(this._heap.dx,this._heap.dy,  this._heap.spriteMoveRes);


		if (this._heap.spriteMoveRes.flags & (DEFINE_SPRITE_MOVE_RESULT_EJECTED_H | DEFINE_SPRITE_MOVE_RESULT_EJECTED_V)){
			this.sprite.map_room.removeSprite(this.sprite);
			this.manager.remove(this);
		}
		else if (--this.lifespan<=0){
			this.sprite.map_room.removeSprite(this.sprite);
			this.manager.remove(this);
		}
	};

