Constrain Attribute - problem with actors not moving in tandem (together)
mhedges
Raised on VCSMember Posts: 634
Hello -
I have recently found this little gem, and I'm already tinkering away at a little game.
I have an actor1 which is currently "coded" to move left or right when the left or right button is pressed. The logic I'm using is basically as follows:
1. I have 2 boolean attributes for movement (1 left, 1 right).
2. If move left = true, then actor1 moves left. Same logic applies to "move right".
I want actor2 to move left or right in tandem with actor1; it's below it, so they are expected to move together.
I am currently stuck. I have read about "constrain attribute" and tried using it according to various tutorials I've seen on Youtube, creating a "real attribute" for actor1's x position and another for y position, constraining real attribute 1's position to actor1's self position, and in turn constraining actor2's position to that of the real attribute for actor 1. As much as I've tried, I can't get actor 2 to move.
All constrain attribute tutorials I've seen deal with "mouse x and y", but I've seen none with "left and right buttons" and "move attribute". Is there a difference in usage/methodology between mouse and left/right buttons?
Thanks!
mhedges
I have recently found this little gem, and I'm already tinkering away at a little game.
I have an actor1 which is currently "coded" to move left or right when the left or right button is pressed. The logic I'm using is basically as follows:
1. I have 2 boolean attributes for movement (1 left, 1 right).
2. If move left = true, then actor1 moves left. Same logic applies to "move right".
I want actor2 to move left or right in tandem with actor1; it's below it, so they are expected to move together.
I am currently stuck. I have read about "constrain attribute" and tried using it according to various tutorials I've seen on Youtube, creating a "real attribute" for actor1's x position and another for y position, constraining real attribute 1's position to actor1's self position, and in turn constraining actor2's position to that of the real attribute for actor 1. As much as I've tried, I can't get actor 2 to move.
All constrain attribute tutorials I've seen deal with "mouse x and y", but I've seen none with "left and right buttons" and "move attribute". Is there a difference in usage/methodology between mouse and left/right buttons?
Thanks!
mhedges
Comments
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thanks for the reply. It is checked as movable.
I created a text box to display the x position, but it's fixed at the original value.
BTW, nice job on Neon-Asteroid Blaster.
My Blog / App Store / Google Play