Fangames > Programming Questions

Is there a way to make an item permanently change the player's bow sprite?

(1/1)

PlasmaKaboom:
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:
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: ---if (global.secretItem[0]) { // replace 0 with your item number
    instance_destroy();
    instance_create(x, y, objBow2);
}

--- End code ---

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

PlasmaKaboom:
Wow you've saved me twice now!  :wixSanic: Thanks alot this was driving me crazy!

Navigation

[0] Message Index

Go to full version