function FlyingObj() {
	this.dirX = 0;
	this.dirY = 0;
	this.x = 0;
	this.y = 0;
	this.img = new Image();

	this.move = function(isFriendly) {
		this.x += this.dirX;
		this.y += this.dirY;
		this.init();
		/* prevent player from playing outside screen */
		if (isFriendly) {
			if (this.x < 0 || this.x2 > canvas.width) {
				this.x -= this.dirX; /* revert */
			}
			if (this.y < 0 || this.y2 > canvas.height) {
				this.y -= this.dirY;
			}
		}
		/* only show image if loaded */
		if (this.img.naturalWidth) {
			ctx.drawImage(this.img, this.x, this.y);
		}
	}

	this.init = function() {
		this.x2 = this.x+this.img.width;
		this.y2 = this.y+this.img.height;
	}

	this.isIndsideObj = function(testObj) {
		if (this.x2 > testObj.x && this.x < testObj.x2) {
			if (this.y2 > testObj.y && this.y < testObj.y2) {
				return true;
			}
		}
		return false;
	}

	/* pos random y-asix, and set x-asix right before screen */
	this.posRandomNewItem = function() {
		this.x = canvas.width-1;
		this.y = Math.round(Math.random()*(canvas.height-60)+20);
	}
}

