Quellcode durchsuchen

samples: cleanup

Daniele Bartolini vor 7 Jahren
Ursprung
Commit
bbe791613f
1 geänderte Dateien mit 16 neuen und 14 gelöschten Zeilen
  1. 16 14
      samples/core/editors/level_editor/level_editor.lua

+ 16 - 14
samples/core/editors/level_editor/level_editor.lua

@@ -118,22 +118,24 @@ function raycast(objects, pos, dir)
 
 
 	for k, v in pairs(objects) do
 	for k, v in pairs(objects) do
 		local t, l, d = v:raycast(pos, dir)
 		local t, l, d = v:raycast(pos, dir)
-		if t ~= -1.0 then
-			-- If sprite
-			if l and d then
-				if l >= layer and d >= depth then
-					layer = l
-					depth = d
-					nearest = t
-					object = v
-				end
-			else
-				if t <= nearest then
-					nearest = t
-					object = v
-				end
+		if t == -1.0 then
+			goto continue
+		end
+		-- If sprite
+		if l and d then
+			if l >= layer and d >= depth then
+				layer = l
+				depth = d
+				nearest = t
+				object = v
+			end
+		else
+			if t <= nearest then
+				nearest = t
+				object = v
 			end
 			end
 		end
 		end
+		::continue::
 	end
 	end
 
 
 	return object, nearest
 	return object, nearest