OnLashoc
Member
Ok so Im working on a platformer to which my Player object (oPlayer) runs into the floating Gun object (oGunPickup) to pick it up with a collision event on the oGunPickup object and here is the code:
So now my player has a gun equipped and is able to shoot and run around within the room shooting and killing enemies... However as soon as I exit the room via a trigger / transition object placed at the exit of the level, and my character is placed in the next room, the gun disappears unless I drag a oGun object and place it in the room.
Since I want to have different gun pickups in the first room, I mean who doesn't like choice? I don't want to place the oGun object in the room because no matter which gun you choose, it is always going to default to the oGun object I placed in the room.
What would be the best way to implement remembering which gun object that was chosen, when transitioning into the next room and so on?
Code:
/// @description Pickup gun
global.hasgun = true;
instance_create_layer(oPlayer.x,oPlayer.y,"Gun",oGun);
audio_play_sound(snGunEquip,10,false);
instance_destroy();
Since I want to have different gun pickups in the first room, I mean who doesn't like choice? I don't want to place the oGun object in the room because no matter which gun you choose, it is always going to default to the oGun object I placed in the room.
What would be the best way to implement remembering which gun object that was chosen, when transitioning into the next room and so on?