summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-01-02 15:54:58 +0100
committerGitHub <noreply@github.com>2017-01-02 15:54:58 +0100
commitc9366f8b563c186b4d0ab09088d09d47580f749d (patch)
tree7b404d449f4cae704eca15ad2689d1ffa31af29d /scene/2d
parentcaddbbe17425def9f1f1a16045e870e3767f4096 (diff)
parentf6262fde11cac8b7d1a3d299042c1af6b321cf24 (diff)
Merge pull request #7410 from nounoursheureux/master
Add the 'finished' signal to AnimatedSprite
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/animated_sprite.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 5a50939579..2ead6b2c96 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -362,6 +362,9 @@ void AnimatedSprite::_notification(int p_what) {
}
} else {
frame++;
+ if (frame==fc-1) {
+ emit_signal(SceneStringNames::get_singleton()->finished);
+ }
}
update();
@@ -696,6 +699,7 @@ void AnimatedSprite::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_res_changed"),&AnimatedSprite::_res_changed);
ADD_SIGNAL(MethodInfo("frame_changed"));
+ ADD_SIGNAL(MethodInfo("finished"));
ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "frames",PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), _SCS("set_sprite_frames"),_SCS("get_sprite_frames"));
ADD_PROPERTY( PropertyInfo( Variant::STRING, "animation"), _SCS("set_animation"),_SCS("get_animation"));