Component not found

For some reason, I get this error when running my game:

This is my code (taken from open source):

  function init(self)
	-- make sure the script will receive user input
	msg.post(".", "acquire_input_focus")
end

function on_input(self, action_id, action)
	-- mouse or spacebar
	if action_id == hash("attack") and action.pressed then
		-- position bullet somewhat offset from the player position
		local pos = go.get_position()
		pos.y = pos.y + 50

		-- spawn a bullet
		local bullet_id = factory.create("#pizza_factory", pos)

		-- animate the bullet
		local distance = 1000                   -- distance in pixels
		local speed = 800                       -- pixels per second
		local duration = distance / speed       -- time in second to travel the full distance
		local to = pos.y + distance
		-- start animation and delete bullet when it has reached its destination
		go.animate(bullet_id, "position.y", go.PLAYBACK_ONCE_FORWARD, to, go.EASING_LINEAR, duration, 0, function()
			go.delete(bullet_id)
		end)
	end
end

And this is my layout:

image

Any ideas on what I can do to fix this??

That is a strange looking error. I don’t see the problem from the screenshots and code you shared… Could you please zip your project and share here (exclude build and .internal folders).

Of course!
Files.zip (73.1 KB)

Let me know if this works, or if you need something else.

Thanks. Here’s the issue:

Screenshot 2023-11-29 at 13.48.20

You’ve manually assigned an image as a collision shape. This won’t work. You can only use basic shapes such as boxes, spheres and capsules. You can also assign a custom convex shape or a tilemap.

The question is why the editor doesn’t complain about this when building using Project->Build. The error is only detected when bundling (which uses our command line tools).

@vlaaad and @mats.gisselson perhaps this is a quickfix?

For my player object, I assigned an image as a collision shape and that worked.
image

How would I assign a collision shape to it?

I’m not sure though, would the collision type affect anything here?

Fixed it! All i had to do was remove projectiles.collection, and create a seperate game object. Thank you for your help!

1 Like