Unfortunately, if I do that, the object itself would be removed. I just want to remove it from the group. Let me be specific.
One of the objects collides with my scope (gun scope) when it does it becomes “onTarget” if it doesn’t collide with the scope it needs to be removed from the “onTarget” group. If the object is “onTarget” then I can send the command to kill it. By having this group it will allow me to have multiple objects on target at the same time, say two object that are overlapping and one becomes on target but the one behind stays on target.
If I use removeSelf() the object would be removed while in reality, the object just went of target.
An object is always in a group. When you create it is is already inside the stage group. So do either
Create another group which you are using just as a placeholder and assign the object into it
or
Get the stage group handler at the beginning when you create your first object (Parent of the object) and then assign it to that. [import]uid: 5712 topic_id: 2205 reply_id: 6727[/import]
is exactly my strategy. I am just having problems with the syntax removing it from that group. In my case onTarget group [import]uid: 8192 topic_id: 2205 reply_id: 6730[/import]
Hi Mark this removes the object. I think I might be confusing you with my inexperience. When I insert an object into a group is it just putting a reference of that object or the actual object into the table? I thought it was just a reference. So when I remove them from a table I am just removing the reference.
What I am trying to do identify what objects are on target in the scope so that if I decide to kill them they get killed. Say there are 6 ships on screen and 2 of them are on Target. I press the trigger and those 2 ships die.
Say one of the ships goes out of target while the other one stays on target and then i press the trigger. Only that ship dies.
Now I thought one way to do that was to create a group or a table and insert a reference to what ship it is on target when it collides with the scope sensor and obviously remove it when it doesn’t collide. Maybe it’s not the way to do it though. [import]uid: 8192 topic_id: 2205 reply_id: 6753[/import]
Then you have to place(move) the object into another group. Like I said in another topic, objects are always inside a group. When they are created, they are already in the STAGE group. By inserting them into a user defined group, you move them to that group. This makes all sence when you think about the parent property. No matter how many times you insert an object inside groups, the parent property will always be the last group you have insert your object into it. An object can never be in more than one group at the same time. [import]uid: 5712 topic_id: 2205 reply_id: 6757[/import]