Using Multiple Animations for Traps


I just finished the Complete Godot 2D course and am playing around with level design in the Martian Mike game. I want to have different animations available for the traps, and have multiple instances with different animations in each level. For example, there is a stationary saw that has a spinning animation; I would like to have variations that move along different patterns, like squares or circles, based on the level design.

I came up with two different approaches. The first is creating multiple scenes for each animation, and then just instantiating the ones I want (stationary saw, circle path saw, etc). The second is by making different animations in the same scene, then turning editable children on and selecting the animation for each trap that is different from the base scene.

Both of these options seem kind of clunky and I was wondering if there is a more advanced solution to handle this functionality. I initially thought I could just create an export variable to choose the desired animation within the inspector, but I am not sure how to do that, if it is possible.


Hi UnknownKaos,

I would probably go through the route of the two scenes method as then you can use both types of traps in the same main scene if you wanted.

I prefer this method as its not changing back and forth between animations unlike the player character in this scene but if you had enemy types that used a character type then using a similar switch like we do for Mike would be preferable.

Hope this helps

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms