|  |  | @@ -35,3 +35,23 @@ function updatePlayerInfo(state) { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | health.textContent = "Health: " + state.player.stats.health; | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | /* | 
		
	
		
			
			|  |  |  | { | 
		
	
		
			
			|  |  |  | func: the function to invoke | 
		
	
		
			
			|  |  |  | delay: how long to wait between invocations | 
		
	
		
			
			|  |  |  | loop: false = no looping, true = loop forever | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | function startTimer(config, state) { | 
		
	
		
			
			|  |  |  | if (config.loop) { | 
		
	
		
			
			|  |  |  | const timeout = setTimeout(() => { | 
		
	
		
			
			|  |  |  | config.func(); | 
		
	
		
			
			|  |  |  | state.timers.global.delete(timeout); | 
		
	
		
			
			|  |  |  | startTimer(config, state); | 
		
	
		
			
			|  |  |  | }, config.delay); | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | state.timers.global.add(timeout); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } |