summaryrefslogtreecommitdiff
path: root/scene/2d/particles_2d.cpp
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2015-12-29 18:53:45 -0300
committerreduz <reduzio@gmail.com>2015-12-29 18:53:45 -0300
commit408a67193ec41e8bfcfbfcc5a65b4141bb663020 (patch)
treeb93417eaf43750c999faf65cb1c30977eb205f20 /scene/2d/particles_2d.cpp
parent555ad5f8b7facb9835ee3533d3b3e956cce4cdd1 (diff)
Added a reset() function to Particles2D, fixes #2472, fixes #2468
Diffstat (limited to 'scene/2d/particles_2d.cpp')
-rw-r--r--scene/2d/particles_2d.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 8f805ceba2..2373af9d0c 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -994,6 +994,15 @@ DVector<Vector2> Particles2D::get_emission_points() const{
return emission_points;
}
+void Particles2D::reset() {
+
+ for(int i=0;i<particles.size();i++) {
+ particles[i].active=false;
+ }
+ time=0;
+ active_count=0;
+}
+
void Particles2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_emitting","active"),&Particles2D::set_emitting);
@@ -1057,6 +1066,7 @@ void Particles2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_color_phase_pos","phase"),&Particles2D::get_color_phase_pos);
ObjectTypeDB::bind_method(_MD("pre_process","time"),&Particles2D::pre_process);
+ ObjectTypeDB::bind_method(_MD("reset"),&Particles2D::reset);
ObjectTypeDB::bind_method(_MD("set_use_local_space","enable"),&Particles2D::set_use_local_space);
ObjectTypeDB::bind_method(_MD("is_using_local_space"),&Particles2D::is_using_local_space);