Sunday, June 1, 2014

Let's continue our program

On our last post, we made a simple script to make a cat move, now let's make a mouse!
Remember the cat we used in our last program?
It's called a "Sprite".
Now, let's add a mouse sprite.
In the sprites section, click on the button "Import sprite"















Now, go find the mouse sprite.
At the beginning of the game, we want the mouse to appear at a random spot, so lets use a "random" block.
Drag a "When flag clicked" block in the script field and below that, put a "go to" block.
If we want to change it's horizontal position, we better use the part that says "x".
In the "Operators" section, drag that random block into the "go to" block.
Remember to drag it in the "x" :-).
since the far left side of the screen is "-240" and the far right is "240", we change the minimum and maximum values to those. Your code should now look like this:







Press the flag
Yay!
Why don't you do the same thing with "y"?
For "y", the minimum and maximum should be "-180" and "180"
Cheers, Codegirl101




5 comments:

  1. Nice. I think people will gain a lot of knowledge from this. My blog.. It's really just what I am doing. I think you have a better blog.

    ReplyDelete
    Replies
    1. Thank you, and to make your blog better, just think of it from your readers point of view :)

      Delete
  2. Nice job codegirl! Your explanations were very clear on how to make a mouse and use Scratch. I will have to try this out some day soon. Keep up the great work.

    ReplyDelete