Friday, November 5, 2010

Gliding/ scratch challenge 3

I used this glide control structure to make bees fly around flowers. Gliding allows a character to smoothly follow a given direction. we can give them the directions points either through typing in the specific points x and y. Or you can type in the name of a character and make another character glide in that direction.

Mouse pointer

This is the simple script for making a character move to a mouse pointer.

  • We have to put the "when flag clicked" button so that we know when the character will begin to chase after the mouse pointer
  • we need to put the forever control option otherwise it will have a time limit which doesn't make any sense
  • of course we need to put the point towards a mouse pointer so that the character faces that way. if we simply do this and not put the "move 10 steps" bit then the character will not move but will simply turn to the mouse pointer
  • The purpose of "move 10 steps" is to make the character chase after the mouse rather than just staying still. I personally found out that 10 steps was too fast therefor  I would recommend 6 steps.

Ants - moving the character

We have made an example in scratch that relates to moving a character. We basically used the same controls we would use for any character and they are listed below. To make an example and actually implement it on a project we added some extra control structures in which enabled us to have a smooth finish. we did find little bugs all the time but  finding them is what made us keep on improving them. Here is a little screenshot of the script.
 This example is basically- making the "mother" ant move towards the fortune cookie. Then when it touches the fortune cookie, it will say "yummy" and make the sound of a "shaker"(we couldn't find the sound of chomp). Then the rest of the "lazy baby" ants come and make that noise too and stay there. and appear to be eating the fortune cookie.

We had to make each of the baby ants eat the fortune cookie. Therefore we had to have separate control structures for each of the ants which instructs them to point towards the cookie and walk to it when the mother ant says yummy. 

Wednesday, October 27, 2010

Control structures


This is a control structure that I made.


When I press the space bar it will rotate 15 degrees and if I press it continuously it will move around itself continuously. If it touches the colour, then it will switch to a different costume or different image.

Moving a character

To basically make a character  move youy need to create 4 different algorithms. Each for the separate directions that you need to go(right left, up and down)
Firstly you put the "when ___key is presses"[The basic keys that are widley used are the left arrow, right arrow, up arrow and down arrow] . This is so that the person has a choice of where to go and this certain key will instigate the algorithm associated with it.
Then we need the "point in direction___". This is to change the direction of the sprite so that it will go to a specific direction.
Then we need to put the "move__steps". this makes the sprite move__steps in the direction they were turned to in the previous command.

That is basically how you make your cahrater move.

 

Scratch challenge 4 - Animation


* Using the flying bat you created in challenge 3, now have your bat fly towards you, by using the “change size” function.

  • This is the script that I can possibly use to make moving animation. This works by firstly adding the "when (green flag) clicked" block. This will help the animation to be organised and start at a certain time rather than just randomly starting.
  • Then we need to put the "forever" block. What this does is makes the instructions inside the block loop forever. That means the bat, which is the animal in this script, will keep flying forever.
  • The purpose of the instructions inside the forever block is to make the bat appear to be flying. How we do this is cahnge between two pictures/ costumes- one of the bat's wings up in the air and the other with the wings down. The 'switch to costume "bat-a"'. I put this at the beginning because the costume needed to be changed from the orignal sprite which was a cat. So basically the bat has its wings up, waits for 0.3seconds, then moves 5 steps forward to make it look like its flyign forward. Then it switches costumes which makes it look loke the wings go down, waits for 0.3 seconds and moves 5 steps forward.
  • At the end i put the "if on edge bounce" block. I f i don't put this then the bat will fly away from the screen. To make the bat stay in the screen, we need to make it turn from teh edges and that is what this block does.
  • Also we need to look at the options at the top of the programme and click on this(the highlighted part which says (only left-right)
  • Usually the bat will go upside down after it bounces off the edge but if you click on this the bat will stay upright.
So this is how to make an animation.

Wednesday, October 20, 2010

Flowcharts

This flowchart is the algorithm for how long the LED light is turned on. After one second it turns off.

This flowchart simply is the algorithm to tell us if the"sunstance" is above freezing or below freezing.


1. Convert one of the algorithms you have created in the previous task into a flowchart, e.g. opening a door, moving through a traffic light.



This is my flowchart for the traffic lights:) click on it for a better view.