"use strict";

var GO_MalfoseOrb = function(){
	this.sprite = new Sprite(GO_MalfoseOrb.spriteSheet,"MalfoseOrb_Claw"); // so all instances have different sprites
	this.sprite.collision_flags = 
		DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_PASSIVE;
	this.sprite.setBoundingBox(5,0,26,15);
	this.sprite.game_object = this; // no longer a generic GO

	this.sprite.frame = 3;

	this.orb = new Sprite(GO_MalfoseOrb.orbSheet,"MalfoseOrb");
	this.orb.game_object = this;
	this.orb_frame = 0;
	this.frame_timer = 0;
};
GO_MalfoseOrb.spriteImg = SDS_Load_Image("art/sheets/sprite/malfoseorb.png");
GO_MalfoseOrb.spriteSheet = new TileSheet(4, 5, 2, 0, GO_MalfoseOrb.spriteImg);
GO_MalfoseOrb.orbSheet = new TileSheet(4, 4, 2, 1, GO_MalfoseOrb.spriteImg);

GO_MalfoseOrb.prototype = new GameObject(
	new Sprite(
		GO_MalfoseOrb.spriteSheet,
		"MalfoseOrb"
	),
	"MalfoseOrb"
	);

	GO_MalfoseOrb.prototype.interactions = 0;

	GO_MalfoseOrb.prototype.bob = [
		-1,
		-1,
		-1,
		-1,
		-1,
		-1,
		-2,
		-2,
		-2,
		-2,
		-3,
		-3,
		-3,
		-3,
		-3,
		-3,
		-3,
		-3,
		-3,
		-3,
		-2,
		-2,
		-2,
		-2,
		-1,
		-1,
		-1,
		-1,
		-1,
		-1,
	];

	GO_MalfoseOrb.prototype.Update = function(){
		++this.frame_timer;
		this.frame_timer %= 30;
		this.orb.frame = Math.floor(this.frame_timer / 5);
		if (this.orb.frame>2) ++this.orb.frame;
		this.orb.x = this.sprite.x;
		this.orb.y = this.sprite.y + 32 + this.bob[this.frame_timer];
	};

	GO_MalfoseOrb.prototype.addToRoom = function(mapRoom){
		mapRoom.addSprite(this.orb);
		mapRoom.addSprite(this.sprite);
	}
