on tap move object
Hi,
I have a 3x3 grid (A1, A2, A3, B1, B2, B3, C1, C2, C3) where there is a shape in the middle of the grid (B2). When I tap the shape, it moves to A3. Is it possible for the same shape at A3 to move to A1 on tap, and again from A1 to C1 on tap?
hello any body?
hello any body?
Hi Sherman,
Apologies for the late reply! Do you have an example of what you're trying to accomplish?
Best,
Danielle
Hi Sherman,
Apologies for the late reply! Do you have an example of what you're trying to accomplish?
Best,
Danielle
You can move the shape to wherever you like. How simple that is depends upon whether or not there is logic to where it is supposed to move to based upon its current location and how complicated that logic is. The most basic approach would be to implement the movement logic based upon shape location using "when" conditions for the move actions.
So, for example, if your grid is 90 x 90 and your shape is 30 x 30, you could create the following move expressions:
On Tap - When (shape:posX.fixed = 30 AND shape.posY.fixed = 30) -> Move shape left:fixed:60 top:fixed:60
Else When (shape:posX.fixed = 60 AND shape.posY.fixed = 0) -> Move shape left:fixed:0 top:fixed:0
Else When (shape:posX.fixed = 0 AND shape.posY.fixed = 0) -> Move shape left:fixed:0 top:fixed:60
However, the larger the number of squares in your grid and the larger the number of possible moves, the more unwieldy this when/else will become. If there is a more definable logic to the shape movement that can be reduced to an algorithm, then you may be able to implement it with a relatively simple when/else expression, possibly made even simpler utilizing relative X and Y positions as opposed to fixed X and Y positions.
You can move the shape to wherever you like. How simple that is depends upon whether or not there is logic to where it is supposed to move to based upon its current location and how complicated that logic is. The most basic approach would be to implement the movement logic based upon shape location using "when" conditions for the move actions.
So, for example, if your grid is 90 x 90 and your shape is 30 x 30, you could create the following move expressions:
On Tap - When (shape:posX.fixed = 30 AND shape.posY.fixed = 30) -> Move shape left:fixed:60 top:fixed:60
Else When (shape:posX.fixed = 60 AND shape.posY.fixed = 0) -> Move shape left:fixed:0 top:fixed:0
Else When (shape:posX.fixed = 0 AND shape.posY.fixed = 0) -> Move shape left:fixed:0 top:fixed:60
However, the larger the number of squares in your grid and the larger the number of possible moves, the more unwieldy this when/else will become. If there is a more definable logic to the shape movement that can be reduced to an algorithm, then you may be able to implement it with a relatively simple when/else expression, possibly made even simpler utilizing relative X and Y positions as opposed to fixed X and Y positions.
Replies have been locked on this page!