Minor error in the example SpriteCollisionMasks

In the main.lua source file in the SpriteCollisionMasks example project, the function “createMonsterSprite” has a function return value of “player” on line 72. The return value does not appear to be used in this example code, so it doesn’t affect the execution of the code. However, it may lead to downstream bugs.

local function createMonsterSprite()

	local monster = Monster()
	monster.type = kMonsterType 	-- a custom field that we can check in our collision handler
	
	monster:setImage(monsterImage)
	local imageWidth, imageHeight = monsterImage:getSize()
	monster:setCollideRect(2, 2, imageWidth-6, imageHeight-4)
	
	monster:moveTo(math.random(30, 370), math.random(30, 210))
	monster.velocityX = math.random(-80, 80)
	monster.velocityY = math.random(-80, 80)
	monster.collisionResponse = gfx.sprite.kCollisionTypeBounce
	
	monster:setGroups({3})					-- monsters are on layer 3
	monster:setCollidesWithGroups({2})		-- players only collide with sprites on layer 2 (monsters and walls)
	
	monsterSprites[#monsterSprites+1] = monster
	monster:addSprite()
	
	return player
end

good catch! I’ll change that to return monster. Thanks!