

InfoBoxPickup = Bonus:createSubClass();

function InfoBoxPickup:init()

	Bonus.init(self);

	self:setTexture("bonuses.tga");
	self:setSpriteFrame(224-32, 0, 256-32, 32);
	self:setSize(32, 32);
	
	self.animFrame = 0;

	self.editorProperties = {windowText = "Put text here."};

end

function InfoBoxPickup:update()

	Bonus.update(self);
	
	self.animFrame = self.animFrame + 0.1;
	
	local animOffset = (math.sin(self.animFrame) / 2) + 0.5;
	animOffset = math.floor(animOffset * 32);
	
	self:setSpriteFrame(224-32, 0, 256-32, 32 + animOffset);
	self:setSize(32, 32 + animOffset);
end

function InfoBoxPickup:collided(otherEnt)

	if otherEnt == "player" then
		
		playSound("data/collect1.ogg");
		
		popupMessageBox(self.editorProperties.windowText);
		
	end
	
	Bonus.collided(self, otherEnt);
	
end

function InfoBoxPickup:save()

	local ret = Bonus.save(self);
	
	ret.animFrame = self.animFrame;
	
	return ret;

end

function InfoBoxPickup:initFromSave(saveData)

	self.animFrame = saveData.animFrame;
	
	if self.animFrame == nil then
		self.animFrame = 0;
	end
	
	Bonus.initFromSave(self, saveData);

end


registerSpawn("InfoBoxPickup");


