Help for weapon system

Hello!

I’ve been trying to create a somewhat simple top-down game that involves being able to pick up melee and use it

my idea was to create a single game object that will contain all the information for the different weapons and simply send a message to the object telling it to switch the current weapon to one it picked up but what I don’t know is how to create the hitboxes for the weapons that will be different sized collision triggers? or is there a way I can resize or create a collision box during runtime? I also doubt that what I’m doing is a very efficient…

1 Like

Hey, welcome to Defold! I think a collection and will be needed for this. There is an example of how to set this up in the manual page showing collections:

Then you would use a collection factory if you need to create multiples of these at runtime. You could use a controller script on one of the game objects for handling the changing or picking up melee weapons.

If you are just doing a single character to start with, then you won’t need a collection factory. You can just put that in your main collection.

1 Like