Whats the best way to remove weapon?

0 favourites
  • 2 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • If I have a weapon or item attached to a character/sprite and the sprite gets destroyed how do I destroy the item?

    Picking nearest seems to cause problems, and if hitting object or overlapping object wont work because it could be overlapping another sprites item who isn't destroyed.

    You see my conundrum?

    What method do you guys use?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If I have a weapon or item attached to a character/sprite and the sprite gets destroyed how do I destroy the item?

    Picking nearest seems to cause problems, and if hitting object or overlapping object wont work because it could be overlapping another sprites item who isn't destroyed.

    You see my conundrum?

    What method do you guys use?

    Since the weapon is a separate sprite and its "link" to a specific character, you can store the Character.UID in the item as a variable. So when your Item or Character gets destroyed. You can pick both the Item or Character based on this:

    The two items:
    Item object
    Character_UID = 100 (Stored character UID)
    
    Character object
    UID = 100
    
    When Item is destroyed:
    Item on destroyed
    Pick Character.UID = Item.Character_UID
    <Do something>
    
    When Character is destroyed:
    Character on destroyed
    Pick Item.Character_UID = Character.UID
    <Do something>
    [/code:1fzl0snb]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)