This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-02-10 01:10:42

Jesscookie
Scratcher
Registered: 2008-02-08
Posts: 100+

What's an X and Y position?

I don't understand how to use x and y position, and the numbers with those scripts. How do I work out these blocks with x and y?


http://i172.photobucket.com/albums/w23/Fresh-Mikey/1995_gif_280x210.gif

Offline

 

#2 2008-02-10 03:42:50

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: What's an X and Y position?

Imagine a point in the centre of the screen.
You can describe that point as being x=0, y=0.  Or, since we know x always comes first, simply as 0,0

You can now describe any other point on the screen on how far away (in pixels) it is from that zero point. 

Positive numbers are to the right for X or upwards for Y
Negative numbers are to the left for X or downwards for Y.

So an object at 20,40 is 20 pixels to the right of the centre of the screen, and 40 pixels up.

And an object at -30, 40 is 30 pixels to the left of the centre of the screen, and 40 pixels up.

(By screen, I mean the scrath display area, not your whole monitor screen - although in full screen mode they are, of course, the same thing)

Does that help?


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

Board footer