From 8906ff2e2755f6f8a2e52f5252afbcbea248c947 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sun, 1 Jan 2017 12:03:58 +0100 Subject: instance_destroy that actually works; no more shared_ptr --- src/objects/obj_control.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') 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 static double yd=0; +static Object *hoiobj; EVENT(create){ draw_set_font(fnt_liber); x=10; y=240; - instance_create(20,20); + hoiobj=instance_create(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){ -- cgit v1.2.3-70-g09d2