"use strict";

var GO_Splash = function(direction){
	this.sprite = new Sprite(GO_Splash.spriteSheet,"Splash");
	this.sprite.collision_flags = 0;
	this.sprite.setBoundingBox(0,0,15,15);
	//this.sprite.constraints=constraints;
	this.sprite.max_step = 0;
	this.sprite.game_object = this; // no longer a generic GO

	this.frame_timer = 0
	this.direction = direction ? direction : 0; // 0 up 1 down

	this.playSound(direction ? "FX_splashdown" : "FX_splashup");

};
GO_Splash.spriteImg = SDS_Load_Image("art/sheets/sprite/splash.png");
GO_Splash.spriteSheet = new TileSheet(4, 4, 2, 1, GO_Splash.spriteImg);

GO_Splash.prototype = new GameObject(
	new Sprite(
		GO_Splash.spriteSheet,
		"Splash"
	),
	"Splash"
	);

	GO_Splash.prototype.interactions = 0;

	GO_Splash.prototype.Update = function(){
		this.frame_timer++;
		this.sprite.frame = this.frame_timer>>1;
		if (this.sprite.frame==4){
			this.sprite.frame=0;
		}
		if (this.sprite.frame>4){
			this.sprite.map_room.removeSprite(this.sprite);
			this.manager.remove(this);
		}
		else if (this.direction){
			this.sprite.frame+=4;
		}
	};
