GameMaker Sprite draw vs instance memory(collision)

T

Toweliepoo

Guest
Hey guys,

I'm working on a game where the player can equip/holster guns, this places the instance on the player's back. Problem is it collides with the player 100% of the time. When i try to pickup guns from the floor the collision is picking up the gun on my back first.

I have a few options to avoid collision with currently holstered/equipped weapons but would like some second opinions;

option 1 : instead of objects, absorb properties, destroy instance and draw sprite on back.
option 2: move obj.x 100000 pixels then do check and move back
option 3: add a masking sprite, change weapon sprite to masked sprite then do check and change sprite back(removes collision mask for my currently equipped weapons)
option 4: deactivate instances, do check and reactivate. this is similar to option 2 but i'm not sure what will be affected by deactivation and if this is a good practice.

Thanks guys.
:D
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Very much option one. It's MUCH easier to maintain, since all the properties for the weapon are in the instance that will be using it, and it also resolves your collision issues. All the other "solutions" are more or less hacks...
 
T

Toweliepoo

Guest
Apologies for the post in the wrong section, still new to the forum and figuring things out. I've used option 1 and can say it was easy enough! I'm looking at purchasing Spine which to my understanding will also rely on this method.

Thanks guys for the valuable inputs!!
 
Top