diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-01 12:03:58 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-01 12:03:58 +0100 |
commit | 8906ff2e2755f6f8a2e52f5252afbcbea248c947 (patch) | |
tree | e684823e99b9182badcb49dd6c2e35409fe40d02 /src/objects | |
parent | a871e68ebd153d9ab4f9f9e36d7b099689e05c38 (diff) |
instance_destroy that actually works; no more shared_ptr
Diffstat (limited to 'src/objects')
-rw-r--r-- | src/objects/obj_control.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/objects/obj_control.cpp b/src/objects/obj_control.cpp index 66b481c..87c685d 100644 --- a/src/objects/obj_control.cpp +++ b/src/objects/obj_control.cpp @@ -1,12 +1,13 @@ OUT #include <cstdlib> static double yd=0; +static Object *hoiobj; EVENT(create){ draw_set_font(fnt_liber); x=10; y=240; - instance_create<obj_hoi>(20,20); + hoiobj=instance_create<obj_hoi>(20,20); } EVENT(step){ @@ -14,6 +15,13 @@ EVENT(step){ y+=yd; yd+=(double)rand()/RAND_MAX*2-y/240; yd*=0.99; + + if(x==100){ + instance_destroy(hoiobj); + } else if(x==200){ + instance_destroy(this); + return; + } } EVENT(draw){ |