<< Chapter < Page
  Teaching beginners to code     Page 5 / 9
Chapter >> Page >
The Cartesian coordinate system The position of sprites on the Stage in the Scratch programming interface is based on a two-dimensional Cartesian coordinate system with the origin at the center of the Stage. The x coordinates range from-240 at the left to +240 at the right. The y coordinates range from +180 at the top to -180 at the bottom.

Three sprites

The area below the stage in Image 4 shows that this program contains two beachballs and one basketball in addition to the Stage. (The beachballs and the basketball are sprites.)

You add a sprite to your program by clicking one of the four buttons immediately below the stage.If you hover your mouse over those buttons going from left to right, the following tooltips appear:

  1. Choose a sprite from library
  2. Paint new sprite
  3. Upload sprite from file
  4. New sprite from camera

In this program, the beachballs and the basketball were added by selecting the first or leftmost button in the row of four buttons and then selecting theappropriate sprite from the library.

Although not visible in the cropped version of the programming interface in Image 4 , when you click on one of the sprites that you have added to the program, thatsprite appears at the top of the rightmost pane. (See Image 6 for example.) Having done that, you can then drag programming blocks into the rightmost pane that define the behavior of thatsprite.

Program code for the LeftBeachball

The code that I wrote (by dragging blocks into the rightmost pane in the programming interface) for the sprite named LeftBeachball is shown in Image 6 . (Note the image of the beachball in the upper right corner. When this is an image of a beachball, all of the scripts in the rightmost panel apply tothat particular beachball sprite.)

Image 6. program code for the left beachball.

Missing image.
Image 6. Program code for the left beachball.

You are already familiar with the tan block with the green flag shown in Image 6 because you learned about it in a previous module. However, theblue block in Image 6 has not been used prior to this module.

Adding the blue go to block to the program

The blue block shown in Image 6 was added to the program module by:

  • Clicking the dark blue button labeled Motion in the upper center of Image 4 .
  • Dragging the blue block shown in Image 6 from the toolbox to therightmost panel and clicking it into place under the tan block.
  • Typing the literal values -200 and 0 into the two white boxes on the blue block.

Coordinate values

If you move the mouse pointer around the stage in the programming interface, the coordinates of the mouse pointer are displayed immediately below the stage as shown in Image 4 . As mentioned earlier, the xcoordinates range from -240 at the left to +240 at the right. The y coordinates range from +180 at the top to -180 at the bottom.

Behavior of the LeftBeachball

The behavior of the script shown in Image 6 can be interpreted as follows: When the user clicks the green flag, cause the sprite named LeftBeachball to move to a location with an x (horizontal) coordinate value of -200 and a y (vertical) coordinate value of 0. Since the origin is at the center of the Stage, this causes the beachball to move to theleft of the origin on the horizontal axis.

Questions & Answers

How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
How can I make nanorobot?
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
how can I make nanorobot?
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Teaching beginners to code. OpenStax CNX. May 27, 2013 Download for free at http://cnx.org/content/col11498/1.20
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Teaching beginners to code' conversation and receive update notifications?