require( "timed_events" )

local game = NewGame()

PlayBackMusic("music/march.ogg")

AddTimedEvent( 4000, function() CreateGreenStuff( 0, -400, { {300, 0}, { 0, 500} }, 5 ) end )
AddTimedEvent( 4000, function() CreateGreenStuff( 0, -400, { {-300, 0}, { 0, 500} }, 5 ) end )

AddTimedEvent( 8000, function() CreateLongThingy( 350, 150, {-350, -150}, 15 ) end )

AddTimedEvent( 2000, function() CreateGreenStuff( -300, -300, { {300, -150}, { -300, 150} }, 10 ) end )
AddTimedEvent(    0, function() CreateGreenStuff(  300, -300, { {-300, -150}, { 300, 150} }, 10 ) end )

AddTimedEvent( 4000, function() CreateGreenRayShooter( 0, -400, {{0, -200}, {-300, 100}} ) end )

AddTimedEvent( 8000, function() CreateBonusStuff( -150, RGB(14, 118, 60), bonus_GreenWeaponThingy ) end )
AddTimedEvent(    0, function() CreateBonusStuff(  150, RGB(10, 10, 255), bonus_BlueWeaponThingy ) end )

AddTimedEvent( 4000, function() CreateGrayStuff( -200, -400, { { 200, 400 } }, 10 ) end )
AddTimedEvent( 0   , function() CreateGrayStuff(  200, -400, { {-200, 400 } }, 10 ) end )

AddTimedEvent( 8000, function() CreateLongThingy( -150, -450, {-150,  450}, 35 ) end )
AddTimedEvent(    0, function() CreateLongThingy(  150,  450, { 150, -450}, 35 ) end )

AddTimedEvent( 2000, function() CreateGreenStuff( -250, -400, { {-250, -50}, { -300, 0} }, 5 ) end )
AddTimedEvent(    0, function() CreateGreenStuff( -250,  400, { {-250,  50}, { -300, 0} }, 5 ) end )
AddTimedEvent(    0, function() CreateGreenStuff(  250, -400, { { 250, -50}, {  300, 0} }, 5 ) end )
AddTimedEvent(    0, function() CreateGreenStuff(  250,  400, { { 250,  50}, {  300, 0} }, 5 ) end )
AddTimedEvent( 4000, function() CreateStarThingy(    0, -400, { 0,  0} ) end )

AddTimedEvent( 4000, function() CreateLongThingy( 64, 450,  {-64, -450}, 35 ) end )
AddTimedEvent(    0, function() CreateLongThingy( -64, 450, {64, -450}, 35 ) end )

AddTimedEvent( 8000, function() CreateBonusStuff( -150, RGB(255, 255, 200), bonus_ShieldThingy  ) end )
AddTimedEvent(    0, function() CreateBonusStuff(  150, RGB(155, 50, 100), bonus_OptionThingy ) end )
AddTimedEvent( 2000, function() CreateGreenStuff( -250, -400, { {-250, -50}, { -300, 0} }, 5 ) end )
AddTimedEvent(    0, function() CreateGreenStuff(  250,  400, { { 250,  50}, {  300, 0} }, 5 ) end )

AddTimedEvent( 4000, function() CreateGreenRayShooter( -150, -400, {{-150, -200}, {-300, 100}} ) end )
AddTimedEvent(    0, function() CreateGreenRayShooter(  150, -400, {{ 150, -200}, { 300, 100}} ) end )

AddTimedEvent( 4000, function() CreateLongThingy( -350, 150, { 350, -450}, 45 ) end )
AddTimedEvent(    0, function() CreateLongThingy(  350, 150, {-350, -450}, 45 ) end )

AddTimedEvent( 4000, function() CreateBlueStuff( 0 ) end )

AddTimedEvent( 4000, function() CreateGreenStuff( 0, -400, { {300, 0}, { 0, 500} }, 5 ) end )
AddTimedEvent( 4000, function() CreateGreenStuff( 0, -400, { {-300, 0}, { 0, 500} }, 5 ) end )

AddTimedEvent( 12000, function() CreateGreenStuff( 0, -400, { {300, 0}, { 0, 500} }, 5 ) end )
AddTimedEvent( 4000, function() CreateGreenStuff( 0, -400, { {-300, 0}, { 0, 500} }, 5 ) end )

AddTimedEvent( 8000, function() CreateBonusStuff( -150, RGB(155, 50, 100), bonus_OptionThingy ) end )
AddTimedEvent(    0, function() CreateBonusStuff(  150, RGB(155, 50, 100), bonus_OptionThingy ) end )
AddTimedEvent( 4000, function() CreateBonusStuff( -150, RGB(10, 10, 255), bonus_BlueWeaponThingy ) end )
AddTimedEvent(    0, function() CreateBonusStuff(  150, RGB(10, 10, 255), bonus_BlueWeaponThingy ) end )

AddTimedEvent( 8000, function() CreateLongThingy( 350, 150,  {-350, -150}, 15 ) end )
AddTimedEvent( 1000, function() CreateLongThingy( -350, 150, {350, -150}, 15 ) end )

AddTimedEvent( 2000, function() CreateStarThingy(  -150, -400, { -150,  0} ) end )
AddTimedEvent( 2000, function() CreateStarThingy(   150, -400, {  150,  0} ) end )
AddTimedEvent( 2000, function() CreateGreenStuff( -250, -400, { {-250, -50}, { -300, 0} }, 5 ) end )
AddTimedEvent(    0, function() CreateGreenStuff(  250,  400, { { 250,  50}, {  300, 0} }, 5 ) end )

AddTimedEvent( 8000, function() CreateBonusStuff( -150, RGB(255, 255, 200), bonus_ShieldThingy  ) end )
AddTimedEvent(    0, function() CreateBonusStuff(  150, RGB(155, 50, 100), bonus_OptionThingy ) end )

AddTimedEvent( 4000, function() CreateGrayStuff( -200, -400, { { 200, 400 } }, 10 ) end )
AddTimedEvent( 0   , function() CreateGrayStuff(  200, -400, { {-200, 400 } }, 10 ) end )
AddTimedEvent( 4000, function() CreateGrayStuff( -300, -150, { { 200, -300 }, { -300, -300} }, 10 ) end )
AddTimedEvent( 0   , function() CreateGrayStuff(  300, -150, { {-200, -300 }, {  300, -300} }, 10 ) end )

AddTimedEvent( 4000, function() CreateGrayStuff(  300, -400, { {-300, -100 }, {300, 100} }, 10 ) end )
AddTimedEvent( 0   , function() CreateGrayStuff( -300, -400, { {300, -100 }, {-300, 100} }, 10 ) end )
AddTimedEvent( 8000, function() CreateStarThingy( -400, 100, { 150, 0} ) end )
AddTimedEvent( 4000, function() CreateStarThingy(  400, 100, {-150, 0} ) end )
AddTimedEvent( 4000, function() CreateStarThingy(  0,  -400, {0, -150} ) end )
AddTimedEvent( 8000, function() CreateGreenStuff(  300, -400, { {-300, -100 }, {300, 100} }, 10 ) end )
AddTimedEvent( 0   , function() CreateGreenStuff( -300, -400, { {300, -100 }, {-300, 100} }, 10 ) end )
AddTimedEvent( 8000, function() CreateBlueStuff( -150 ) end )
AddTimedEvent( 0   , function() CreateBlueStuff(  150 ) end )
AddTimedEvent( 8000, function() CreateGrayStuff(  300, -400, { {-300, -100 }, {300, 100} }, 10 ) end )
AddTimedEvent( 0   , function() CreateGrayStuff( -300, -400, { {300, -100 }, {-300, 100} }, 10 ) end )
AddTimedEvent( 8000, function() CreateStarThingy( -400, 100, { 150, 0} ) end )
AddTimedEvent( 4000, function() CreateOrangeBoomy( -300, -400,  {-150, -150} ) end )
AddTimedEvent( 1000, function() CreateOrangeBoomy(  300, -400,  { 150, -150} ) end )
AddTimedEvent( 1000, function() CreateOrangeBoomy( -300,  400,  {-150,  150} ) end )
AddTimedEvent( 1000, function() CreateOrangeBoomy(  300,  400,  { 150,  150} ) end )
AddTimedEvent( 4000, function() CreateGreenStuff( -300, -150, { { 200, -300 }, { -300, -300} }, 10 ) end )
AddTimedEvent( 0   , function() CreateGreenStuff(  300, -150, { {-200, -300 }, {  300, -300} }, 10 ) end )

AddTimedEvent( 16000, function() CreateBonusStuff( -150, RGB(155, 50, 100), bonus_OptionThingy ) end )
AddTimedEvent( 0    , function() CreateBonusStuff(  150, RGB(118, 14, 14),  bonus_RedWeaponThingy ) end )
AddTimedEvent( 0    , function() CreateBonusStuff(    0, RGB(40, 62, 158),  bonus_BombThingy ) end )

AddTimedEvent( 12000, function() CreateBossCross() end )

BossDefeated = function()

end

background =
{
	{ CreateSprite( "back_desunside", 0, 0 ), 0, 0, 2, 750 },
	{ CreateSprite( "back_desunside" ,0, 0), 0, -750, 2, 750 },
	{ CreateSprite( "back_desunside" ,0, 0), 0, -2*750, 2, 750 },
s}

function ProcessBackground()
	for k, v in pairs(background) do
			v[3] = v[3] + v[4]
			SetObjPos(v[1], v[2], v[3] )
			if v[3] >= v[5] then
				v[3] = v[3] - 2*v[5]
			end
	end
end

return game
