Hi everyone,
Hope you are doing well!
I was wondering if it was possible to change sprites through a custom action in an action list.
I noted that there was this thread: https://adventurecreator.org/forum/discussion/5617/how-to-change-an-objects-sprite
where it mentions something about creating a custom action to do this.
Might it be possible to see how a script like this could be coded?
Thank you!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
A series of tutorials on writing custom Actions can be found here.
What's your use-case for this? Are you looking to change a sprite to one of a small number of options? If so, I'd still recommend the use of animation for this.
If you attach an Animator component to the Sprite Renderer and assign an animation for each Sprite it can have, you can then use AC's Object: Animate Action to play the animation that changes the sprite.
Hm, the use cases I have so far is just to replace a single sprite (when clicked) with another sprite.
E.g: The user clicks on a set of three tomatoes and picks up two of them, so the graphic is just a sole tomato now.
Might it make sense to still create a custom action, or would an animation be more efficient?
An animation would be more efficient, as it would also allow use of the Remember Animator component to record the change in save-game data.
Got it, thank you!