Detecting when an object is 'destroyed' problem...
Question:
Is there a way to detect when an object is actually destroyed?
The problem I am running into is that I have all of my actions tied to the condition statement, whether or not the object actually exists. So:
If string$ = "67", then object is destroyed and points are added. However, string$ can actually equal "67" even when the object was not on the screen to begin with, and in that case the points are still added.
Any thoughts? The screen shot below should help highlight the problem (nevermind that I probably have more conditions then needed; I'm still on the beginning learning curve). Flags are used to add points and play sounds.
http://www.carolinarover.com/appletreeproblem.JPG http://www.carolinarover.com/appletreeproblem.JPG
Re: Detecting when an object is 'destroyed' problem...
You can count the number of "C-appels".
1) Insert event (together with string$=67)
2) Rightclick special object (top left)
3) Select "compare two general values"
4) Retrieve data from an object
5) Rightclick the "C-appel" object
6) Select count-> number of objects
7) Select is greater then 0
Re: Detecting when an object is 'destroyed' problem...
I think you may hve a problem with your code in the fact that you are destroying an object and then toggling flags.
Try placing your destroy event at the end of the event list. Not sure if this will resolve the issue you are having but it may go some way towards it.
Re: Detecting when an object is 'destroyed' problem...
It makes no difference since the object won't be destroyed until the end of the event loop. Until then it will act like normal.
Re: Detecting when an object is 'destroyed' problem...
I tried counting as Sieg suggested and moving events around, but I'm still picking up false inputs. I may go back and rework everything with a different method. Thanks for the ideas guys.
Re: Detecting when an object is 'destroyed' problem...
Just set a flag on and when the flag is triggered on then destroy it.