Do you ever play FishChomp games in Scratch that the big fish have to eat small fish by following the mouse pointer? Or have
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" block
. 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
. 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
. 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 effects
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.

Thanks for this - you saved my life!! And it's so ludicrously simple...
ReplyDeleteyeah. Thank for this. It gave me an idea for a game. :D
ReplyDelete