I'm in the middle of making an RTS on scratch but I've run into a problem. I need to be able to have the sprite glide to the location I click, however the time it takes needs to vary on the distance. So 10 pixels could take a second but 100 pixels could take 10 seconds. I already have : when flag clicked, forever, if mouse down? and selected = 1 (variable), point towards mouse pointer, Glide 2 seconds to x: mouse x y: mouse y.
any Ideas? sorry for no scratch blocks, I didn't want to get it wrong.
Offline
when gf clicked forever if <mouse down?> point towards [mouse-pointer v] glide ((distance to [mouse-pointer v]) * (0.1)) secs to x: (mouse x) y: (mouse y) end end
Offline
No problem! Good luck with your project.
Offline