Wednesday, December 24, 2008

How to Make Object Following Mouse Pointer

Do you ever play FishChomp games in Scratch that the big fish have to eat small fish by following the mouse pointer? Or have tutor 3-1 you imagined your bee looking for pollen in the flower by following the movement of the mouse pointer? Interaction between mouse pointer and Sprite objects are very important in creating video games. But we are only know how to build behavior of single Sprite until now. We still don't understand how script from one Sprite could interact with other object.

Now let's we try. This interaction can be build with three step of logics. First, we must changing the direction of the Sprite object towards the mouse pointer. We can do this by using "point towards mouse-pointer" blockpoint towards. Don't forget to click the down-arrow and choose mouse-pointer from the list. Second, we have to move the Sprite object in that direction several steps. We can get this by picking "move ... steps" block move. And the last step is adjusting the distance and speed between the movement of mouse pointer and the movement of our Sprite object. This can be done with delay block wait . But we have to make some experiment to determine how much step and how long the delay every cycle of program, to find the best response of our object to the movement of our mouse pointer.

We have develop program that produces the effectstutor 3-2 of the interaction. Now you can feel how easily the program interaction between Sprite objects and mouse pointer in the Scratch. You can use this stack for various effect in your games.


  1. Thanks for this - you saved my life!! And it's so ludicrously simple...

  2. yeah. Thank for this. It gave me an idea for a game. :D

  3. You could just use The block Forever (control) and the block go to (motion) and select mouse-pointer. This would make it continuously follow the cursor.

  4. Can I simply say what a relіef to uncоver an individuаl whо tгuly understаnds whаt they're talking about on the web. You definitely know how to bring an issue to light and make it important. More and more people ought to read this and understand this side of your story. I was surprised that you're not more popular gіvеn that you certainly havе thе gift.

    My ωeb page: Same Day Payday Loans

  5. Article writіng is alѕo a fun, if
    you be famіliar with after that you can writе if nоt it is difficult to write.

    Havе a looκ at my web-site; payday loans

  6. fatty liver treatment in hindi fatty liver treatment in hindi fatty liver treatment in hindi

    my blog ... what to eat to reverse fatty liver