Aidin wrote:
@xnailbender: Why would I need to differentiate them? Whenever any of them is called, it will be called by reference and I’ll have pointer to the actual object.
Newb here, so understand I’m not an expert on anything. Just trying to help and hope I’m not creating confusion. As I stated, I haven’t used the physics drag module before either.
I’m not really sure what your “pointer” actually is. I probably just don’t see the obvious.
From my “newbish” viewpoint, it seems to me your only “pointer” is “foodObject”.
I just don’t see how 1 “foodObject” is differentiated from another “foodObject”,
I can see how “foodObject[1]” is differentiated from “foodObject[2]” as the index values are different.
It seems to me the event.target is “foodObject”, unless the event.target can somehow differentiate 1 similar object from another, really not sure how that works if it does.
It seems to me, foodObject.x = event.target.x will move both similar foodObject’s at the same time when 1 of them is dragged, causing unexpected behavior.
I can see how foodObject[1].x = event.target.x will move only foodObject[1].x when dragged and foodObject[2] will be unaffected.
I’m thinking this is why both of your foodObjects are moving simultaneously when dragged, but not really sure because every similar object I spawn has an index reference.
If your get your issue resolved, I’d like to know what the solution was if you’d post it here.
Hope this helps,
Nail
[import]uid: 106779 topic_id: 34449 reply_id: 137506[/import]