1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

gun help

Discussion in 'Programming' started by Kirpy, May 8, 2019.

  1. Kirpy

    Kirpy Member

    Joined:
    Mar 22, 2019
    Posts:
    25
    ok so i have multiple guns that i would like to respawn every once and a while. My main point is how would i make it so when i collide with one anything the player is holding will get destroyed and will keep the new one.
    I can provide code if needed. Thanks in advanced.
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,988
    Store the ID of the active gun that the player is using in the player instance. When the player picks up a new gun, then you can easily destroy the old one by referencing that variable holding its ID.

    instance_destroy(obj_player.equipped_gun);

    Then assign the new gun's ID to the player.
     
    Luke Norton likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice