Coding with objects groups

I am grouping several objects for the same code with the objects groups editor. I would like to know if you have had any conflict with the code when you introduce some conditions or action for a specific object of the group inside of a group event. I share a piece of the code for if you noticed any wrong…

Explain:

I choose all the objects of “RayoBonusGrupo”, we have done it above and it should not be necessary. I do not understand why but inside a “group” event if we start to refer to objects of that group in certain actions, such as when creating “RayoBonusCopia”, unwanted things start to happen. In short, in a simple way choosing all the RayoBonusGrupo objects, I repeat it was not necessary since we have done it above, I have managed to deal with the conflict generated by having made a complex group event.

Watching this code is necessary pick all the objects in the down red circle again to refer all the instances of the same object? I think it is not necessary because in the up red circle already I have done it…

Maybe is a conflict because I picking all the instance of another object in the hidden code, there is an event minimized.

If I am following the logic in the right way, you choose all the objects in the first circle, indeed, yet you apply a condition to them “IF variable RayoBonus of Rail = /= Variable(Contador)”, so just the objects filling said condition are taken into account for the next events.

In the second circle, you choose all and every objects in the group again, over writting the previous condition, or at least, it is what I think it is happening.

Maybe, moving the events that you want to apply to every object outside the said condition, so all the objects can be tested if they must be hide or deleted in the same level as the “IF variable RayoBonus of Rail = /= Variable(Contador)” condition.

If this can’t be done, then maybe choosing them again is your best option.

Right now:

  • Choose all
    • Test for Variable Contador
      • Test if object must be hide or deleted

Possible way:

  • Choose all
    • Test Variable Contador
    • Test if object must be hide or deleted
1 Like

but the next events are not indent to the condition “IF variable RayoBonus of Rail = /= Variable(Contador)”…

Ok I have found the problem that it is not related with objects groups. I think it is not the behaviour expected but I understand it is complicated.

I have used my experiment method to minimalize the problem in an external project like this:

what is happening here is that the first instance involved is the one with the collision, colored blue. After the instances involved are all the instances blues with the action “pick all”. But we create a new instance after this “pick all” so in the final action of delete object instances is not deleted the new instance.

I was confused because being that instance inside an event that collects all the instances that instance should be affected but it has been created after picking all the instances action. It is very confusing because you are watching delete object action just after create object and the logic is it should be deleted xD.

No, the delete is applied to the filtered list of NewObject2. That list does not contain the NewObejct2 you created in the event just prior to the delete.

With the pick all, GDevelop creates a list of all the objects. That is the list of objects at the time the pick all was invoked. You then create a new object. It does not get automatically added to the list. You’ll need to select all again if you want to do that.

2 Likes

Yes, this is the same I have explained, just It is a situation that I have never encountered because I am not very experienced in programming