-- write out that we loaded sucessfully (more or less, anyway)
io.write("Starting OO script for Test-Level2 in BlinkenLUA / ",_VERSION,"!\n");
 
-- Register my init call
bs.callback.engine.init("myInit");

-- simple init callback that creates 2 objects
function myInit ()

	bs.include("_wormhole.inc.bsl");
	Wormhole:new(323, 500, 500, 500, "64");
	Wormhole:new(723, 500, 200, 500, "32");
	
	bs.include("_tropflava.inc.bsl");
	TropfLava:new(1500, 608, 0, 15);
	TropfLava:new(1580, 608, 10, 10);
	TropfLava:new(1620, 608, 5, 1);
	TropfLava:new(1670, 608, 20, 55);
	TropfLava:new(1500, 480, 10, 15);
	TropfLava:new(1550, 480, 20, 15);
	TropfLava:new(1600, 480, 0, 15);
	TropfLava:new(1750, 480, 15, 15);
	
	bs.include("_freezeabletropflava.inc.bsl");
	FreezeableTropfLava:new (2381, 544, 15, 23, 2784, 672);
	FreezeableTropfLava:new (1752, 608, 15, 42, 1784, 672);
	
	bs.include("_stopabletropflava.inc.bsl");
	StopableTropfLava:new (1852, 608, 15, 42, 1884, 672);
	StopableTropfLava:new (1226, 192, 15, 42, 1319, 256);

	-- User objects
	gfx_a = bs.anim.load("fg_progress_%.bmp", 0, 5, 5, bs.anim.type.pingpong);
	gfx_b = bs.anim.load("fg_explode_%.bmp", 0, 3, 5, bs.anim.type.forwardloop);

	--for k, v in pairs (bs.level.tiles.types) do 
	print("a = ", bs.level.tiles.types["char_a"]);
	print("b = ", bs.level.tiles.types["char_b"]);
	for k, v in pairs (bs.level.tiles.data) do 
		--print ("key = ", k, " value = ", v)
		if v.type == bs.level.tiles.types["char_a"] then
			bs.obj.new(v.x, v.y, gfx_a, "visible");
			print("type = ", v.type, " x = ", v.x, " y = ", v.y);
		elseif v.type == bs.level.tiles.types["char_b"] then
			bs.obj.new(v.x, v.y, gfx_b, "visible");
			print("type = ", v.type, " x = ", v.x, " y = ", v.y);
		end
	end

end
