Snaping an Actor to Another Actor
mdiak47
Member Posts: 7
I have to to be able to snap one actor to another using the directional keys.
Example:
If there were two actors, one above and below, an actor in the middle -- I would want that actor to snap to the top or bottom actor using the up or down key.
Any advice is welcome and appreciated.
Example:
If there were two actors, one above and below, an actor in the middle -- I would want that actor to snap to the top or bottom actor using the up or down key.
Any advice is welcome and appreciated.
Comments
lets say, actor 1 is top, actor 2 is middle, actor 3 is bottom.
.........
Add rule, in actor 2.
if button (up) is released
change attribute, actor 2 position to actor 1 position.
add another rule,
if button (down) is released
change attribute, actor 2 position to actor 3 position.
.....
I've chosen to use 'released' rather than 'pressed' for button state, but try either and see which you prefer.
Hope that helps.
If you dont want your middle actor (actor 2) to be actually the same position as the aboive or below actors but have it so they are touching, simply minus/plus half the height of actor 1 or 2 to the rule.
Lets say half of actor 1 is 50.
eg.
change attribute, (actor 2 position) to (actor 1 position -50)