godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

New get function to node animatedsprite2d #10137

Closed Zecronx closed 4 months ago

Zecronx commented 4 months ago

Describe the project you are working on

Estoy trabajando en un juego de naves donde hay waves y enemigos, jefes y etapas que varian segun el score

Describe the problem or limitation you are having in your project

la limitacion es que no consigo como traerme una lista o saber cuales son las animaciones presentes del animatedsprite2d y lo quiero tener para una funcion que por ejemplo al llegar a 100 de score el personaje, busque en la lista de animaciones del animatedsprite si existe "x" animacion y la coloque

Describe the feature / enhancement and how it helps to overcome the problem or limitation

la solucion para mi deberia ser agregar una funcion get nueva al animatedsprite2d que sea algo como: animated_sprite_2d.get_animation_list()

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

como un codigo, una funcion mas agregada al nodo animated sprite 2d que permita traer una lista de las animaciones que tiene el nodo

If this enhancement will not be used often, can it be worked around with a few lines of script?

si

Is there a reason why this should be core and not an add-on in the asset library?

si debido a que es una funcion que ya deberia traer el nodo por defecto, muchas gracias :D

Calinou commented 4 months ago

This is an English-speaking platform, so proposals must be written in English (use a translator if needed). Please edit your proposal accordingly.

kleonc commented 4 months ago

You can already fetch these from the SpriteFrames assigned to the AnimatedSprite2D. Doing an_animated_sprite_2d.sprite_frames.has_animation("animation_name") etc. is straighforward, I don't think shorthands are needed (would just bloat the API).

See:

Zecronx commented 4 months ago

thanks for all, sorry for this issues, really thanks :D <3

Calinou commented 4 months ago

Closing per @kleonc's comment.