So I looked around for a few days for code that allowed me to click the stage and have my sprite move there while changing costumes to make the walking look realistic.
Here is the code that I used http://tinypic.com/r/10z35w5/6
Also please give credit where credit is due, this is the only code I have seen(maybe I would have found it if I had looked harder) for a workable Click-To-Move in Scratch. Thanks!
P.S. this works with multiple units (which is what I have) I use a Green Selector sprite(which is actually what happens in the game I am recreating) and depending on which sprite the Green Selector sprite is around decides which peon will move.
If anyone would like to see the code for my Green Selector sprite just ask!
Offline
Here is the rest of my code for flawless movement (minus costume changes, soon to come). Moves at same speed no matter where you click-to-move
when I receive [Move v] set [DistanceVariable v] to ( [sqrt v] of ((((mouse x) - ( [x position v] of [Sprite3 v] )) * ((mouse x) - ( [x position v] of [Sprite3 v] ))) + (((mouse y) - ( [y position v] of [Sprite3 v] )) * ((mouse y) - ( [y position v] of [Sprite3 v] )))))
when I receive [Move v] if <(SinlgePeonSelector) = [1]> reset timer if <( [x position v] of [Sprite3 v] ) > (MouseX)> repeat until <(timer) > ((DistanceVariable) / (62.5))> switch to costume [PeonBirdsEye v] wait (0.2) secs switch to costume [costume3 v] wait (0.2) secs end else repeat until <(timer) > ((DistanceVariable) / (62.5))> switch to costume [PeonBirdsEye v] wait (0.2) secs switch to costume [costume2 v] wait (0.2) secs end end switch to costume [PeonBirdsEye v] end
Offline
Huge thanks to Scratcher LS97 for the plug-in that allowed me to export my blocks of code right onto the forums rather than having to write them out myself/screenshoting it. You can check out the plug-in at http://scratch.mit.edu/forums/viewtopic.php?id=102175
Offline