Tuesday, January 22, 2013

Dancing Bear

Dancing Bear


Try to recreate what you see in this video:
The challenge is to create a Dancing Bear that responds to your key presses by moving his arms, legs, and ears.

Hints:

There are two ways you can do something like this:
  1. One of the ways you have worked with before in your animations. 
  2. The other way uses fewer costumes and implements variables. 



Friday, January 18, 2013

Spinning Ball

In this tutorial, we will cover how to make a ball sprite appear as if it were spinning!

Start with a fresh project. Delete any sprite that may already be there by right-clicking on it and selecting delete from the menu which appears, or by clicking the scissors at the top of the screen and then clicking on the sprite that you want to get rid of.
Now we need to make a new sprite. Select the "Paint new sprite" option from just below the stage.
You should get a window that looks like this.

Let's select the "Ellipse tool". Ellipse is a fancy word for circle that can also look like an oval.

Let's make sure our options for the Ellipse look like this. We want an outline circle in black. The outline option is the second of the two at the top.
Now we bring our mouse over to the drawing area. Hold down the Shift key and click and drag your mouse to create a circle. If you don't hold down the shift key you can still make a pretty good circle. Your circle should look something like this.
Next we want to get the "Line tool" to draw some sections on our ball.

In the drawing area, click the edge of your ball and drag a line across to make it look something like this.

Next we want to fill in those areas with some colors to make it look pretty. Choose the "Fill tool" to fill in areas with a color.
Choose one color to start, it can be whatever you want except black because our lines are black. 
Click in one of the open areas to fill it in with your new color. Pick two different colors and fill in the other two areas. Your ball should look something like this. Nice!
If your project looks like this now after pressing "OK" on your sprite editing, then you're right where you need to be! If not, look back through the directions to see if there was something you missed.
Now we want to do something to make it look like our sprite is a spinning ball. From the middle top of the screen, select the "Costumes" tab. Something that looks like this should come up.
We are going to make our ball look like it's spinning by switching between three different costumes. To make a new costume, click the "Copy" button. Make two copies. When you are done, it should look like this.
Next we want to change the way our other costumes look. Leave the first one alone and select the picture called "costume2." Press the edit button next to "costume2."
Using the same colors you did for the first costume, move them over one area by filling in that area with the next color. Your "costume2" should now look something like this. Notice how it looks different from the first costume we made?
Do the same to "costume3" to make it look something like this. We should now have three different costumes in one sprite. Now let's make it look like it's moving!
Make sure you are in the "Scripts" tab and not the "Costumes" tab. From the Purple Looks Menu bring a "next costume" script into the scripting area.
From the Orange Control Menu, bring over a "when 'green flag' clicked" script header, a "forever" script and a "wait (1) secs" script.Combine them so they look like this. The "forever" script just below the "when 'green flag' clicked" script header, and the "next costume" and "wait (1) secs" scripts within the "forever" script.
I decided to change the time to .5 seconds so that my ball would spin faster.
Press the Green Flag button. Congratulations, your sprite now looks like it's spinning!
















Smooth Key Press

If you remember our tutorial on Simple Key Movement and are ready for something a little more advanced, you've come to the right place! This key movement will result in smoother motion of your sprite and the ability to move in a diagonal line.

Start with a new project, I've named mine "smoothMovement".


This is what our original movement scripts looked like, but we got  sticky movement and  we could only move in one direction at a time. So, how do we make sure we have smooth movement and can move in the diagonal?
From the Orange Control Menu:
Take a "when 'green flag' clicked" script header and attach a "forever" script to it. What this means is that whenever the green flag is clicked, we will forever activate all the scripts inside the forever loop.
From the Light Blue Sensing Menu:Notice the "key [space] pressed?" pointed script? This kind of script can go anywhere that has an open spot for a pointed script. Pointed scripts ask questions and will activate when the condition is met or the question is true.
Grab an "if <>" script, place it inside the "forever" script. Place the "key [space] pressed?" inside the "if <>" script. Change the "key [space] pressed?" script to read "key [up arrow] pressed?"
As we did in the other tutorial, from the Blue Motion menu, bring a "point in direction (0)" script and a "move (10) steps" script into the "if <key [up arrow] pressed?>" script. When the green flag is clicked, these scripts will activate, once the condition (up arrow being pressed) is met.
Duplicate the "if <key [up arrow] pressed?>" block to account for the other keys and directions we want our sprite to move in. When you are finished it should look something like this. 
Once you are finished, save your project and glory in the ability to move a sprite around the screen smoothly!











Thursday, January 17, 2013

Simple Key Press

In this tutorial we will cover basic key controls for a single sprite. If you're looking for something a little more advanced, check out the Smooth Key Movement tutorial.

Start with a new sketch and pick a sprite.  Or, simply make a new sprite within one of your projects.
From the Orange Control Menu:Select the "when [space] key pressed" script header. Click the small, black triangle to bring up a menu and select "up arrow" from the menu. Now, whenever you press the "up arrow," this script header will activate all the scripts under it. Cool!
From the Blue Motion Menu:
Select the "point in direction (90)" script...
...and place it directly under the "when [up arrow] key pressed" script header. Change the direction by clicking on the little black triangle and selecting "(0) up."
Again from the Blue Motion Menu, select the "move (10) steps" script and place it directly under the "point in direction (0)" script. Now, when we press the "up arrow," the sprite will point up and move 10 steps in that direction. Yay!
We can reuse the code we just made instead of going back to each of the menus by clicking and holding down on the top "when [up arrow] key pressed" script header and selecting "duplicate" from the menu that appears. Put the copy just below this version and change the key pressed and direction to each of the new versions you place.
When you are finished, your script area should look like this.
If your sprite is like mine and flips around so it's upside down when it moves, just go to the top of your screen and click one of the three buttons next to the image to make it only face left-right or not change facing at all. Name and save your project and you're done. Congratulations! You now have a sprite that moves around when you press the arrow keys!