Old man needs a simple answer ... click and centre a 2048x2048 actor on the clicked/touched spot
I'm not sure I understand the X/Y co-ordinate system used in Gamesalad.
I have a scene set to iPad landscape mode and an actor who is 2048x2048 pixels ("move-radius", a simple 10Kb slightly opaque black ping with a 512 pixel circle cut out of the middle, that will be used to indicate how far a clicked piece can move, and obviously extends out well past the edges of the scene). I have some round checker pieces in the scene. I am able to get the game to, when I click a piece, make the move-radius piece alpha go to 1 to show up; and then disappear when I stop dragging the piece. Lovely.
My problem -> For some reason I can not figure out how to make move-radius *centre itself where the mouse was clicked*; that is 1024 pixels right and down from it's own top left corner. The centre point of the cut out circle should appear right where I clicked.
How do I make that happen? Thanks from an old guy.
I have a scene set to iPad landscape mode and an actor who is 2048x2048 pixels ("move-radius", a simple 10Kb slightly opaque black ping with a 512 pixel circle cut out of the middle, that will be used to indicate how far a clicked piece can move, and obviously extends out well past the edges of the scene). I have some round checker pieces in the scene. I am able to get the game to, when I click a piece, make the move-radius piece alpha go to 1 to show up; and then disappear when I stop dragging the piece. Lovely.
My problem -> For some reason I can not figure out how to make move-radius *centre itself where the mouse was clicked*; that is 1024 pixels right and down from it's own top left corner. The centre point of the cut out circle should appear right where I clicked.
How do I make that happen? Thanks from an old guy.
Comments
Make 3 game attributes for the location. One X, One Y and a Boolean.
Make a rule on the actor that you want to move "when mouse is clicked, change One X to mouse.position.X" and "when mouse is clicked change One Y to mouse position Y"
And directly following those rules change your boolean to "true".
Now another rule...
When Boolean = true
Change attribute self.position.x to One X
Change attribute self.position.y to One Y
Change Boolean to false, end rule.
You might want to use constrain attribute rules depending on your desired behavior. But that should give you a good start. Let me know if it helped
When mouse button is down
-- constrain attribute self.position.x to mouse.position.x
-- constrain attribute self.position.y to mouse.position.y
That will make it follow your mouse or finger where ever it goes.
Now if you don't want it to follow and instead just snap to where it's at you can use change attribute instead of constrain.
Cheers
Aaron
Cheers
Also I'm removing your download link from above so you don't get to many people downloading your entire project with less than honorable intentions.
Cheers