Touch Actor A but Not Actor B behind it...
cotigchez
Member, PRO Posts: 6
I was wondering if there is a way to keep touch constrained to the Actor that was first touched. I have actors that can be dragged around, sometimes overlapping other actors. The problem is that when one of these actors is overlapping another actor (both which can be dragged around) and is touched, both actors essentially stick to each other, then, indefinitely or until scene is reset. Can I design actors to not be able to be touched-through?
Comments
I am not sure without working out for myself but it should be possible (I think)...
Hope that helps. kipper
simply create an Index Attribute in Game set to 0
assign an index number to your characters... in your case 1 or 2
on each actor
Rule when touch is pressed
--changeAttribute to correct index #
--and Rule when IndexAttribute = that #
----ConstrainAttribute --self.Position.X To: touch1.Position.X
----ConstrainAttribute --self.Position.Y To: touch1.Position.Y
Rule when touch is released changeAttribute index To: 0
this should also make only the top actor selectable...
(I also placed actors on different (new) layers to control display in front of behind other actors....)
MH