diff options
| author | Wilhem Barbier | 2017-01-02 12:24:37 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-01-12 19:15:30 +0100 |
| commit | 0b6d4e92b549d60c1e319e663de3c0af16e27b37 (patch) | |
| tree | 55c80fa482a3b6f421a6a225e458f3522e769f80 /scene/2d/animated_sprite.cpp | |
| parent | d8223ffa75f7028bb104001e7195233f335556f2 (diff) | |
| download | godot-0b6d4e92b549d60c1e319e663de3c0af16e27b37.tar.gz godot-0b6d4e92b549d60c1e319e663de3c0af16e27b37.tar.zst godot-0b6d4e92b549d60c1e319e663de3c0af16e27b37.zip | |
Add the 'finished' signal to AnimatedSprite
(cherry picked from commit f6262fde11cac8b7d1a3d299042c1af6b321cf24)
Diffstat (limited to '')
| -rw-r--r-- | scene/2d/animated_sprite.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index 5a5093957..2ead6b2c9 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")); |
