alextrevisan / LPCAnimatedSprite2D

With this addon you simply add a LPC spritesheet to a character and it automaticly generates the animations for the Godot4 sprites
MIT License
44 stars 6 forks source link

Main node required to be called from parent #39

Open Loufe opened 3 weeks ago

Loufe commented 3 weeks ago

Working on adjusting my code to the refactor right now, running into this odd case:

image

Whereas before it was simply LPC.LoadAnimations(). For people who implement the add-on like I do, doesn't passing this reference around waste resources? Just wondering why we can't call a "load animations" function from the main LPC node.

alextrevisan commented 3 weeks ago

The resources wasted in this case are minimal, since this is not a function that is called every frame, or affect directly the performance. This maybe called in specific areas of the game, or in the beggining, so I do not think this case will matter.

But to simplify this call, you can implement this function on the LPCAnimatedSprite2D and LPCAnimatedSprite3D

func LoadAnimations() -> void:
    LPC_base.LoadAnimations(self)

then use it like before:

LPC.LoadAnimations()