Hi. I've done a search and alot of what I found on this subject has helped with this Method. But it still doesn't want to work right.
Now I have 2 Types in use. Gog and Food. Each has been added to the FoodLayer. I have 30 Food and 1 Gog.
This method is called by Food. The main problem is that the 'Collided' object array only contains the Food type that has called it and wont contain the Gog when I collide it with a Food, so I never have that '1' printed. Every Food and Gog I create will have the ID as the type (So If I craeted G:Gog the id will be G).
I've seen posts where other people have got this working but I still cant get it right myself so I guess I just havent understood how it works.
Does anyone know what I'm doing wrong?
Thanks
Matthew
Local Collided:Object[], CollidedObj:Object, G:Gog Collided = CollideRect(X,Y,7,7,FoodLayer,0) For CollidedObj = EachIn Collided If Gog(CollidedObj) Print 1 G = Gog(CollidedObj) G.Energy:+10 RemoveLink Self.Link Exit End If Next
Now I have 2 Types in use. Gog and Food. Each has been added to the FoodLayer. I have 30 Food and 1 Gog.
This method is called by Food. The main problem is that the 'Collided' object array only contains the Food type that has called it and wont contain the Gog when I collide it with a Food, so I never have that '1' printed. Every Food and Gog I create will have the ID as the type (So If I craeted G:Gog the id will be G).
I've seen posts where other people have got this working but I still cant get it right myself so I guess I just havent understood how it works.
Does anyone know what I'm doing wrong?
Thanks
Matthew