 		app.death @
 		return
 
+	###
+	Builds a timer for deactivating the tile
+	###
 	startTimer: () =>
 		@timerID = setTimeout @deactivate, (parseInt @activeTime) + (parseInt @delay)
 		return
 
+	###
+	Kills the timer, if any is set
+	###
 	stopTimer: () =>
 		if @timerID?
 			clearTimeout @timerID

###
	Tile can move the player to different map locations
###
_ = require 'lodash'

Entity = require './Entity.coffee'

class Tile extends Entity
	constructor: (@game, @layer, @data) ->
		super @game, @layer, @data

		if @data.properties.times?
			times = @data.properties.times.split ','
			@activeTime = times[0]

			@killPlayer()
			return

		# Ignite the timer to reactivate the tile
		@timerID = setTimeout @reactivate, @inactiveTime
		return

	###
	Re add the sprite to the scene and make the tile walkable
	###
	reactivate: () =>
		super

		# Ignite the timer to deactivate the tile
		@timerID = setTimeout @deactivate, @activeTime
		return

	###
	Player dies
	###
	killPlayer: () =>
		console.log 'you fell into blissful eternity'

