–1 vote

How can I add multiples textures in one sprite?

in Engine by (171 points)

1 Answer

0 votes

What are you trying to achieve?

You can not add multiple image textures to a single 'Sprite' node, but you can swap them in gdscript:

extends Node2D

var image1 = load("res://icon.png")
var image2 = load("res://test_sprite.png")

func _ready():
    $Sprite.texture = image2 # set the texture you want

On the other hand, if you are just trying to make an animation, you have two options:

1 - Use an AnimatedSprite node if your animation frames are spread in a bunch of different images files.
2 - Use a Sprite node and change the "Hframes", "Vframes" and "Frame" properties in the Inspector if you are using a spritesheet.

For more information on 2d animation: 2D Sprite animation

by (244 points)

Look the tree of the player:
enter image description here

Below I have 3 animations and here its my code to show one animation:

$Jogador/sprites_batalha/Poses.play("Normal")

But nothing happens, still showing the main sprite. What im doing wrong?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.