diff options
Diffstat (limited to 'scene/2d/parallax_background.cpp')
-rw-r--r-- | scene/2d/parallax_background.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp index 7f2e9efd96..1b6ab66fcc 100644 --- a/scene/2d/parallax_background.cpp +++ b/scene/2d/parallax_background.cpp @@ -104,16 +104,18 @@ void ParallaxBackground::_update_scroll() { } ofs = -ofs; + final_offset=ofs; + for(int i=0;i<get_child_count();i++) { ParallaxLayer *l=get_child(i)->cast_to<ParallaxLayer>(); if (!l) continue; - if (ignore_camera_zoom) - l->set_base_offset_and_scale(ofs, 1.0); - else - l->set_base_offset_and_scale(ofs, scale); + if (ignore_camera_zoom) + l->set_base_offset_and_scale(ofs, 1.0); + else + l->set_base_offset_and_scale(ofs, scale); } } @@ -180,6 +182,11 @@ bool ParallaxBackground::is_ignore_camera_zoom(){ } +Vector2 ParallaxBackground::get_final_offset() const { + + return final_offset; +} + void ParallaxBackground::_bind_methods() { ObjectTypeDB::bind_method(_MD("_camera_moved"),&ParallaxBackground::_camera_moved); |