sprite animation code problems

gibberingmouthergibberingmouther Posts: 11Member
edited December 2016 in 2D

i was following this tutorial: http://www.gamefromscratch.com/post/2015/06/03/Godot-Engine-Tutorial-Part-9-Sprite-Animation.aspx

it worked up until i added the actual code. the animated sprite object just doesn't show up in the viewport where i put it. i get the following pattern of output:

2
no draw no anim: New Anim
2
2
2
2
2
3
no draw no anim: New Anim
3
3
3
3
3
4
no draw no anim: New Anim
(etc.)

i've read and read the docs, though not everything, but i just don't really have the hang of scripting in Godot yet. but anyway, although i've tinkered quite a bit, i am not sure what's wrong with this code. if anybody could help get me moving that would be great!

New Anim is the name of my animation in the inspector btw.

Answers

  • KioriKiori Posts: 184Admin

    If you wanna hide something use the helper with the paragraph symbol in the text edit options, [spoiler] wont do anything. :smiley:

    If you know markdown you can use that directly.

  • AvencherusAvencherus Posts: 34Member
    edited December 2016 Answer ✓

    The bug I found is that get_frame_count() requires an animation name as a parameter. When you set up AnimatedSprites their animations have names in the panel. The first one created seems to be called default.

    if(get_frame() == self.get_sprite_frames().get_frame_count("default")-1):

Sign In or Register to comment.