Changing Self.Physics.movable
simo103
Member, PRO Posts: 1,331
I have an actor that I can drag and move. On touch I set an attribute to tell the game that it is being moved. That attribute triggers others Self.Physics.movable to false so the other actors don't move.
It doesn't work for me. (Note there are collision behaviors so the actors can be stacked and exploded).
Can I set the movable to false by a rule? And at the same time have collision behaviors so the moving actor can stack on the others?
thanks.
It doesn't work for me. (Note there are collision behaviors so the actors can be stacked and exploded).
Can I set the movable to false by a rule? And at the same time have collision behaviors so the moving actor can stack on the others?
thanks.
Comments
Well, technically you CAN change it, but it has no effect.
Do you think setting and holding those actors to their x and y position whilst the other actor is being moved is the way to solve this?
You might have to make duplicate Actors, one that has its movable set to true, and one to false.
When you pick up an actor, spawn the nonmovable actors in place of the movable ones - then destroy the movable ones. When you release the actor, switch them back. Definitely a pain, but it might be the only way.
game.Attribute ActorMoving = 0 (Index type)
on each actor
an attribute myIndex# = (an assigned # for that Actor)
[Rule]
when Touch is pressed
---ChangeAttribute game.ActorMoving To: self.myIndex#
---[Rule]
---when game.ActorMoving = self.myIndex#
-----ConstrainAttributes so you can drag
[Rule]
when Touch is released
---ChangeAttribute game.ActorMoving To: 0
I did this with 25 drag-able actors...
perhaps it will work for you... though you may have to add a 'busy' boolean to eliminate possible multi-touches interference.
MH
Thanks for the help.
MH .. thanks for your suggestion also .. luckily I only needed to move one actor so the above worked but I have kept your note on file as it looks handy for a future project.