79645131

Date: 2025-05-30 08:34:07
Score: 1
Natty:
Report link

For anyone stumbling across this in 2025, I've used the above code and it worked brilliantly (thanks Antoine), but there a couple of small changes required for Godot 4.3 (I've yet to upgrade to 4.4 so can't comment there):

### This

var reference_frames: SpriteFrames = $AnimatedSprite.frames

### is now

var reference_frames: SpriteFrames = $AnimatedSprite.sprite_frames

### And this

var updated_texture: AtlasTexture = reference_frames.get_frame(animation, i).duplicate()

### is now

var updated_texture: AtlasTexture = reference_frames.get_frame_texture(animation, i).duplicate()

I'm pleased I found this post as a lot of posts I found simply said to use a Sprite2D with animation player, but I was stubborn and knew there must be a way of swapping out sprite sheets in code for AnimatedSprite2D.

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Whitelisted phrase (-1): it worked
  • RegEx Blacklisted phrase (1): can't comment
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Dave B