loading = true

while loading == true do
	-------Loading Screen----------
	title = Image.load("gfx/bg/loading.png")

	screen.waitVblankStart(60) 

	screen:blit(0, 0, title, false)
	screen.waitVblankStart()
	screen.flip() 

	screen.waitVblankStart(240)
	
	Music.volume(128) 
	
	---- Initialize some vars -----
	blue = Color.new(0 , 153, 255)
    	white = Color.new(255 , 255, 255)
    
	title = Image.load("gfx/bg/title.png")
	background = Image.load("gfx/bg/background.png")

	player1 = Image.load("gfx/sprites/player/right.png")
	player2 = Image.load("gfx/sprites/player/left.png")
	player3 = Image.load("gfx/sprites/player/up.png")
	player4 = Image.load("gfx/sprites/player/down.png")

	player = {}
	player.x = 67
	player.y = 190
	player.img = player1
	
	
	NPC = {}
	NPC.x = 40
	NPC.y = 75
	NPC.img = Image.load("gfx/sprites/NPC1/person1.png")
	

	NPC1 = {}
	NPC1.x = 300
	NPC1.y = 75
	NPC1.img = Image.load("gfx/sprites/NPC1/person2.png")
		

	-- INIT GAMEPAD --
	pad = Controls.read()

	-- INIT TIMER --
	gameTimer = Timer.new()
	gameTimer:start()
	oldTime = gameTimer:time()

	-- SET AUDIO VOLUME --
	Music.volume(128)

	status = "title"   -- go to title screen first

	--*****INIT INGAME MENU*****--
	IGM = {}
	IGM.background = Image.load("gfx/bg/igMenuBG.png")
	IGM.x = 0
	IGM.y = 0
	IGM.active = 0
	IGM.btnResume = {}
	IGM.btnResume.img = Image.load("gfx/buttons/btnResumeA.png")
	IGM.btnResume.roll = Image.load("gfx/buttons/btnResumeB.png")
	IGM.btnResume.x = 240 - (IGM.btnResume.img:width()/2)
	IGM.btnResume.y = 20
	IGM.btnQuit = {}
	IGM.btnQuit.img = Image.load("gfx/buttons/btnQuitA.png")
	IGM.btnQuit.roll = Image.load("gfx/buttons/btnQuitB.png")
	IGM.btnQuit.x = 240 - (IGM.btnQuit.img:width()/2)
	IGM.btnQuit.y = 50
	
    --*******INIT CONSOLE********--
    console = {}
    console.x = 90
    console.y = IGM.x + 40
    console.font = Font.createMonoSpaced()
    
	--*****SET RUNNING STATE*****--
	running = true

	--*****FUNCTION DEFINITIONS*****--
	dofile("playerFunc.lua")
	dofile("gfxFunc.lua")
	dofile("menuFunc.lua")

	loading = false
end