Hey everyone!
So I'm trying to make a game where you use your mouse to guide a little dot to the end and the dot follows your mouse. Right now, it follows directly wherever my mouse goes and I don't really want that. I want it so that when you move your mouse, the dot slowly approaches it. If your mouse is very far away from the dot, then the dot will go to it quickly and slow down when it comes near to it. I've tried making variables to like reduce the speed but it just doesn't work.
Also, I want to put a little pen tool on the dot. It's pretty simple. It has to last for 2 seconds of the mouse moving and the closer the pen marks are to the dot, the brighter they are (red). Can someone please help me out? Thanks.
Offline
Actually , this would work. The effect you're searching for is called "easing" i am using a mobile phone right now so I cant provide explicit details, but please go ahead and look at the project I made. It contains such effect. Just download it.
Also be nice if you can comment on it(the project I mean)
Offline
Thanks so much Secretmapper!!!
Now all I need is the pen thing, but I don't think it's that important.
Offline
You can try this
when gf clicked forever repeat until <touching [mouse pointer v]?> point towards [mouse pointer v] move [1] steps//you can replace the 1 with a bigger number to make it go faster. end
Offline
He wants to ease it, not simply have the dot follow the mouse, Ideas
Offline
Can someone tell a mod to close this or do we leave threads like this open here? The OP had already managed to achieve what he was planning to do (of course, there's that pen, but still...)
Offline
Okay.
First thing first.
The dot thing is relatively simple.
When gf clicked forever glide (0.5) secs to x: (mouse x) y: (mouse y) //You can set how fast it detects the new coords by tweeking the secs wait (0.2) secs //If you want a slight pause between the detection endPlease forgive me if the code doesn't show up D:
forever if <(distance) < 30> // If the distance is under 30 then you'll speed up set <velocity v> to (3) else set <velocity v> to (1)I have no idea how to use the pen tool. So I can't help you in that aspect D:
Last edited by Paddle2See (2012-12-23 09:52:02)
Offline
Okay, so for the dot following the mouse like you described:
when gf clicked forever point towards [mouse-pointer v] move ((distance to [mouse-pointer v]) / (any amount)) stepsYou can replace the (any amount) variable with any number. The larger the number, the slower it goes near to the mouse-pointer.
set pen color to [#FF0000] reset timer pen down repeat until <(timer) = (2)> set pen shade to ((200) - (distance to [mouse-pointer v])) end pen upHope this helps with your project!
Last edited by powerpoint56 (2012-12-23 11:35:27)
Offline
Aditya007 wrote:
You can do this
when gf clicked forever point towards [mouse pointer] move (distance) steps if <(distance to [mouse pointer v]) > [30]> set (distance) to 5 else set (distance) to 2 end
Offline
Ideas wrote:
You can try this
when gf clicked forever repeat until <touching [mouse pointer v]?> point towards [mouse pointer v] move [1] steps//you can replace the 1 with a bigger number to make it go faster. end
This is the best solution posted so far. Could be improved a little checking the distance to the mouse pointer - otherwise it might jerk when touching the mouse:
when gf clicked set [speed v] to [5] forever if <(distance to [mouse pointer v]) > [10]> point towards [mouse pointer v] move (speed) steps end end
Offline
I know you've already been helped, but I can't help but throw in my spin on the coding, which would look something like:
The advantages of this one aside from powerpoint's (which would also work very well) is that you can use your direction value for something else at the same time. Maybe make the dot spin as a cosmetic effect? I don't know.
Changing the .2 in each of the blocks with those to a smaller number, like .1, would slow down the motion, while making it larger would increase the motion.
Last edited by Kileymeister_test (2012-12-27 10:10:14)
Offline
Usmanproductions wrote:
Hey everyone!
So I'm trying to make a game where you use your mouse to guide a little dot to the end and the dot follows your mouse. Right now, it follows directly wherever my mouse goes and I don't really want that. I want it so that when you move your mouse, the dot slowly approaches it. If your mouse is very far away from the dot, then the dot will go to it quickly and slow down when it comes near to it. I've tried making variables to like reduce the speed but it just doesn't work.
Also, I want to put a little pen tool on the dot. It's pretty simple. It has to last for 2 seconds of the mouse moving and the closer the pen marks are to the dot, the brighter they are (red). Can someone please help me out? Thanks.
Make it so the sprite points in the direction of the mouse pointer then make it move at a slow speed.
Hope this helped,
MINECARFTPE123
Offline
I made a project Here which solves your problems
Offline