-- the "player" object
Player = {}
Player.__index = Player

--{x = 10, y = 440, speed = 3, animate = false, anim = nil, img = nil}

-- create the object
function Player.create(w, y, w, h, speed)
  local p = {}            -- new object
  p.x = x or 0
  p.y = y or 0
  p.width = w
  p.height = h
  p.speed = speed
  p.animate = false
  p.anim = {}
  return setmetatable(p,Player) -- return Player handle lookup
end

-- show()
function Player:show(show_x,show_y)
  if not self.visible then
    self.count = self.timer
    self.x = show_x + self.xoffset
    self.y = show_y + self.yoffset
    self.visible = true
  end
end

-- countdown()
function Player:countdown()
  if self.visible then
    self.count = self.count - 1
    if self.count <= 0 then
      self.visible = false
    end
  end
end
