<commit_before>--Play setup
function Start()
	winSizeX, winSizeY = getWindowSize()
	
	Done = false
	
	local e = newEntity()
	
	if e == nil then
		log("[WARNING]: e is nil")
	else
		e:add("Drawable")
		e:add("Movable")
		e:add("Physical")
		e:add("Name")
		
		setTexture(e:getDrawable(), "./data/textures/ship.png")
		setMoveVelocity(e:getMovable(), 100)
		setPosition(e:getPhysical(), 400, 20)
		setSize(e:getPhysical(), getSpriteSize(e:getDrawable()))
		setName(e:getName(), "Lua Entity")
	end
end

function Update()
	for i = 0, getTotalEntities() - 1 do
		local e = getEntity(i)
		local p = e:getPhysical()
		local x, y = getPosition(p)
		local w, h = getSize(p)
		
		if x < 0 then
			setPosition(p, 0, y)
		end
		if x + w > winSizeX then
			setPosition(p, winSizeX - w, y)
		end
		
		if y < 0 then
			setPosition(p, x, 0)
		end
		if y + h > winSizeY then
			setPosition(p, x, winSizeY - h)
		end
	end
end<commit_msg>added a comment<commit_after>--Play setup
function Start()
	winSizeX, winSizeY = getWindowSize()
	
	Done = false
	
	local e = newEntity()
	
	if e == nil then
		log("[WARNING]: e is nil")
	else
		e:add("Drawable")
		e:add("Movable")
		e:add("Physical")
		e:add("Name")
		
		setTexture(e:getDrawable(), "./data/textures/ship.png")
		setMoveVelocity(e:getMovable(), 100)
		setPosition(e:getPhysical(), 400, 20)
		setSize(e:getPhysical(), getSpriteSize(e:getDrawable()))
		setName(e:getName(), "Lua Entity")
	end
end

function Update()
	--bound entities to the world size
	for i = 0, getTotalEntities() - 1 do
		local e = getEntity(i)
		local p = e:getPhysical()
		local x, y = getPosition(p)
		local w, h = getSize(p)
		
		if x < 0 then
			setPosition(p, 0, y)
		end
		if x + w > winSizeX then
			setPosition(p, winSizeX - w, y)
		end
		
		if y < 0 then
			setPosition(p, x, 0)
		end
		if y + h > winSizeY then
			setPosition(p, x, winSizeY - h)
		end
	end
end
{'fraction_non_alphanumeric': 0.14498933901918976, 'fraction_numerical': 0.014925373134328358, 'mean_word_length': 3.42688679245283, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2458588', 'n_tokens_mistral': 842, 'n_tokens_neox': 723, 'n_words': 205}