"use strict";

var GO_WaterAltar = function(checkevent){
	this.sprite = new Sprite(GO_WaterAltar.spriteSheet,"WaterAltar"); // 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._makeCheckable(checkevent);

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

GO_WaterAltar.prototype = new GameObject(
	new Sprite(
		GO_WaterAltar.spriteSheet,
		"WaterAltar"
	),
	"WaterAltar"
	);

	GO_WaterAltar.prototype.interactions = 0;

	GO_WaterAltar.prototype.bob = [
		-11,
		-11,
		-11,
		-12,
		-12,
		-12,
		-13,
		-13,
		-14,
		-14,
		-15,
		-15,
		-15,
		-16,
		-16,
		-16,
		-16,
		-15,
		-15,
		-15,
		-14,
		-14,
		-13,
		-13,
		-12,
		-12,
		-12,
		-11,
		-11,
		-11,
	];

	GO_WaterAltar.prototype.Update = function(){
		++this.frame_timer;
		this.frame_timer %= 30;
		this.orb.frame = Math.floor(this.frame_timer / 5);
		this.orb.x = this.sprite.x+8;
		this.orb.y = this.sprite.y + this.bob[this.frame_timer];
	};