Author Topic: Is there a way to make an item permanently change the player's bow sprite?  (Read 1462 times)

PlasmaKaboom

  • Wannabe
  • Posts: 15
  • OS:
  • Unknown Unknown
  • Browser:
  • Chrome 54.0.2840.101 Chrome 54.0.2840.101
    • View Profile
  • Playstyle: Keyboard
I am trying to make it so that once my player touches the "objSecretItem", the item changes my player's bow sprite permanently.

I am new to GameMaker and coding in general so I'm sure there is probably a simple answer for this.

The closest I have gotten to getting it to work is by modifying the already premade "objSecretItem" by adding a "change instance" under "actions" that changes "objBow" to "objBow2" (my bow sprite I made). When I press reset or warp to another room, the bow's new sprite stays there, however; when I die it returns back to the original sprite. I want it to keep the new sprite I made even after I die.

Am I doing this in a weird way? Am I making it too complicated? Any help would be appreciated

patrickgh3

  • Spike Dodger
  • Posts: 169
  • stay optimistic! :D
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Chrome 55.0.2883.87 Chrome 55.0.2883.87
    • View Profile
    • Github
  • Playstyle: Keyboard
Re: Is there a way to make an item permanently change the player's bow sprite?
« Reply #1 on: December 26, 2016, 12:22:37 AM »
Hi Plasma. So the way I would do this is to add code in the step event of objBow that detects if the secret is gotten, and if true, then delete itself and create an objBow2. So like what you did, but inside the bow step event instead of the objSecretItem collision event. The code would be

Code: [Select]
if (global.secretItem[0]) { // replace 0 with your item number
    instance_destroy();
    instance_create(x, y, objBow2);
}

You can also copy this code to the create event which should get rid of the 1-frame delay when you respawn.

PlasmaKaboom

  • Wannabe
  • Posts: 15
  • OS:
  • Unknown Unknown
  • Browser:
  • Chrome 54.0.2840.101 Chrome 54.0.2840.101
    • View Profile
  • Playstyle: Keyboard
Re: Is there a way to make an item permanently change the player's bow sprite?
« Reply #2 on: December 27, 2016, 12:49:01 PM »
Wow you've saved me twice now!  :wixSanic: Thanks alot this was driving me crazy!