Ah, I know that issue well. Events don’t excel at dealing with two instances of the same type independently.
Personally I like just having a single type, putting that into a family, and adding the instance variables to a family. That way you can use picking to get two separate instances and still access the variables for both.
I’ve attempted to two family method but I ran into the same issue. Can’t access the instance variables in one of them.
A third tool we have is sprite(2).x. That expression will give you the x of the sprite with iid=2 no matter what is picked, and it will work for any property.
So for your example you probably could do a hybrid of iid and the second family idea. The instance variables would be added to family1, and the second family2 would have the same objects and would be used to utilize the overlapping conditions. Anyways to access the variables from a family2 instance you’d do family1(family2.iid).z.
In theory something like this would then work. I’m going with the premise that family1.iid and family2.iid have the same value for the same object.
Every tick
— family1: add 300*dt to vz
— family1: add self.vz*dt to z
family1: z>0
— family1: set z to 0
— family1: set vz to 0
For each family1
Family1 is overlapping family2
For each family2
Compare family1.z<family1(family2.iid).z
Compare: family1.z > family1(family2.iid).z-family1(family2.iid).zheight
Compare: family1.z< family1(family2.iid).z+family1.zheight
— family1: set z to family1(family2.iid).z-family1(family2.iid).zheight
— family1: set vz to family1(family2.iid).vz