lg = love.graphics
la = love.audio
FrameWidth, FrameHeight = lg.getDimensions()
rand = love.math.random
require 'stage'

start = true
sounds = {
  wronggnome = {
      love.audio.newSource('sounds/notme1.ogg','static'),
      love.audio.newSource('sounds/notme2.ogg','static'),
      love.audio.newSource('sounds/notme3.ogg','static')
    },
  music = love.audio.newSource('sounds/teddy-bear-waltz.mp3','static'), --Kevin Macleod
  badclick = love.audio.newSource('sounds/bad-click.wav','static'),
  bell= love.audio.newSource('sounds/bell.ogg','static'),
  tick = love.audio.newSource('sounds/ticking.wav','static'),
  cuckoo = love.audio.newSource('sounds/cuckoo.wav','static'),
  stop = love.audio.newSource('sounds/stop.wav','static')
  }

--procedurally generated gnomes that move around a scene with perlin noise.
--there's a timer that ticks down
--there is a bar at the bottom with a portrait of the gnome you need to find
--when you find and click on the proper gnome, you get a point and it goes to a new scene
--goal is to get as many points as possible before time runs out (if you find it within 2 seconds you get a time bonus)

--gnomes = {}
--function generateGnomes()
-- for i=1,maxGnomes do
--   generateGnomes()
-- end
-- function generateGnomes()
--   local gnome = {
--   ...gnome properties
--   }
--   table.insert(gnomes,gnome)
--  return gnome??
-- end
  
--targetGnome = gnomes[1]
--scenes: park, city square, beach, backyard


--TO DO
--next level function
----procedurally generated backgrounds
----remove found gnome from gnomeSelection
----draw smaller version of found gnome in infobar
----timer with minuses and bonuses (see Plant Party)
  --timer = timer -1 * dt
  --score.timer = score.timer + dt
  --score.timersin = score.timersin + dt*2/timer
  --score.timersize = score.timersize + dt/timer
  --score.timersx = score.timersize + 0.2 * math.sin(score.timersin*score.timer)
  --score.timersy = score.timersx


----quick switch to new BG and regen gnomes
--music
--sfx (clicking, gnome says "Uh?!", success chime, low time, time bonus, time minus)
--

function love.load()
	stage:load()
end

function love.update(dt)
	stage:update(dt)
end

function love.draw()
  lg.setDefaultFilter('nearest','nearest')
  stage:draw()
end


function CheckCollisionPoint(x1,y1,x2,y2,w,h)
  return x1 < x2+w and
         x2 < x1 and
         y1 < y2+h and
         y2 < y1
end
