how to change animated sprites frames

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dazzalar

I 'm trying to make a game inwhich I can change the Players “Skin” using Animated Sprite frames.

now I’ve created a signal in script:

func _on_GreenSprite_body_entered(body):
animatedSprite.frames = load(“res://Characters/PlayerGreenSkin.tres”)

but when i leave the current scene it reverts back to the old skin how do i get it save the playersskin.tres so that its applied permanently across all levels

You’ll have to keep the information of the player in a persistant object and reapply it when the player is spawned again in another scene.

With gdscript it’s a singleton, with c# it’s a static class.

If you don’t know how to make a singleton, you make a script for it, and then you go to:

Project → project settings → Autoload → Click the folder icon → Select your script → Click add.

The singleton is a object that never dies and will be able to be called directly from script by name.

Guliver_Jham | 2023-02-08 21:55