Making a Character move with the mouse

I have a student that wants to connect the mouse to her Hero Sprite instead of using the counter pattern. She made it work, but she can’t figure out how to make his legs move and have him face a different direction when connected to the mouse. Is this possible, and if so how?

Could you post the code?

If I’m understanding correctly, it sounds like she wants the sprite to change directions automatically based on the direction of movement. One way of doing this would be to create a variable to track the sprite’s previous x position and use conditionals to continuously check if the x position is increasing and decreasing. Here’s an example built onto on the bubbles from lesson 13:

Hope this helps!


that helps alot!! She will appreciate that! In addition, when the character moves in the draw loop using the counter pattern or velocity is uses both of the small animations in the animation tab, so the legs look like it is constantly moving. Is there a way to keep that movement when the sprite is “attached” to the mouse?

Lindsey Saylor
Edna Hill Middle School
7th/ 8th Grade Computer Science