I have a timer that spawns an enemy object every few seconds.
In my game I need to kill these objects. When I shoot and kill an object and use destroy all the other objects get killed. How can I make each object individual.
Printable View
I have a timer that spawns an enemy object every few seconds.
In my game I need to kill these objects. When I shoot and kill an object and use destroy all the other objects get killed. How can I make each object individual.
Spread Value will give you seperate ID's.
Marv
You don't need spread values.
Can you post your code in text form for detecting when to kill an enemy?
I don't know how to copy and paste the code
Just started working with MF in the last week.
I have an event that fires an object towards the other objects that get created in a timer. So the objects that get created by the timer all look the same. When my bullet object hits any of these other objects a destroy is called which kills all the same objects instead of the one the bullet hit.
I tried spread value but it did not work.
When I say in text format I mean you type it out manually, letter by letter. :p
Could you upload an example to the File Archive forum? Not you're whole project, just an example where it destroys all enemies and not only the one that was hit. You can attach the MFA to your post using the File manager link underneath your posting box. ;)
okay, I uploaded the file
OK, I have looked at the file and I see what you are doing wrong. You are destroying ALL the spiders when a global value is at a certian number, which yo add to when you hit the spider. Instead, store this value in an alterable value of the spider things and use "Compare to Aletrable Value of Object" from the spider object. This way MMF2 will 'select' only the objects that meet the condition, and only perform actions (such as destroy) on the selected objects. If no objects were selectd by a condition, then by default all objects are selected. ;)
You are right :grin: and it is working now.
Thank you