function OnCreate(self)
	-- object-local variable for keeping the elapsed time
	self.time_elapsed = 0
end

function OnThink(self)
	-- update the elapsed time variable
	self.time_elapsed = self.time_elapsed + Timer:GetTimeDiff()
	
	if (self.time_elapsed >= 2) then
		-- get the current entity position
		local oldPos = self:GetPosition()
		
		-- create new random x and y positions
		local newX = Util:GetRandFloatSym(200)
		local newY = Util:GetRandFloatSym(200)
		
		-- assign it to the entity
		self:SetPosition(newX, newY, oldPos.z)
		
		-- reset the elapsed time variable
		self.time_elapsed = 0
	end
end

function OnSerialize(self, ar)
	-- Simply re-initialize the time_elapsed variable to 0 after loading the scene
	if (ar:IsLoading()) then
		self.time_elapsed = 0
	end
end

