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

#1 2012-11-17 15:59:59

Mik_Ael
New Scratcher
Registered: 2012-11-17
Posts: 15

Coordinates of an object

Hi everyone !

I started using Scratch recently and have a problem understanding how coordinates works for an object placed on the scene.

I have this bird I want to move from left to right, then right to left and so on.
The coordinates of my bird on the screen don't fit those displayed in the mouse's coordinates zone... how does it works ?

Thanks in advance !

Offline

 

#2 2012-11-17 16:16:17

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Coordinates of an object

The way it works is that each sprite has a set center and you're seeing its coordinates. Your mouse also has a center and it has to be directly over the sprite's center or else the coordinates will differ.

Anyway, I hope that this answers your question!


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2012-11-17 16:21:58

GenChico
Scratcher
Registered: 2012-11-08
Posts: 100+

Re: Coordinates of an object

I don't understand your problem completely but then again I'm tired. Sorry if this just confuses you more then anything.



Ok the scratch programing thing is made out of a x and y grid. X is the horizontal lines of the grid, going from left to right. A positive x value in a movement block makes the sprite go right, while a negative one makes it go left. The y is the vertical line, up or down. A positive y makes the sprite go up, while a negative goes down. To find the cooords if a object you double click on it then look up in the upper-left hand corner of the screen.


http://i.imgur.com/Cb8HC.png

Offline

 

#4 2012-11-17 16:40:05

Mik_Ael
New Scratcher
Registered: 2012-11-17
Posts: 15

Re: Coordinates of an object

Thanks a lot Ernie and GenChico !  big_smile  This indeed answers my question( which I confess was a bit hard to to understand ^^')

So, if I want my bird to start in the left end on the screen and travel to the right end, i'll use something like below but value is to be put instead of 10000 in my example ?

when gf clicked
forever
  repeat until <(x position) = [10000]>
    move [1] step
  end
end

Offline

 

#5 2012-11-17 16:43:10

Mik_Ael
New Scratcher
Registered: 2012-11-17
Posts: 15

Re: Coordinates of an object

"what value is to be put instead of 10000 ?" sorry for the double post, I forgot a word there.

Offline

 

#6 2012-11-17 16:48:27

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Coordinates of an object

Mik_Ael wrote:

Thanks a lot Ernie and GenChico !  big_smile  This indeed answers my question( which I confess was a bit hard to to understand ^^')

So, if I want my bird to start in the left end on the screen and travel to the right end, i'll use something like below but value is to be put instead of 10000 in my example ?

when gf clicked
forever
  repeat until <(x position) = [10000]>
    move [1] steps
  end

Fixed. Anway, what you might want to do is first, create a script like this:

when gf clicked
forever
 change x by (1)
And once you've run that (which you can do by clicking it), use the sprite's x position instead of 100,000.

Anyway, I hope that this helps!

Last edited by ErnieParke (2012-11-17 16:48:36)


http://i46.tinypic.com/35ismmc.png

Offline

 

#7 2012-11-17 16:51:29

Bailz_Gamer
Scratcher
Registered: 2010-12-04
Posts: 100+

Re: Coordinates of an object

Step 1: Drag your bird to wherever you want it to be on the left

Step 2: Check your bird's co-ordinates as shown below

This is where you find the co-ordinates
http://i49.tinypic.com/f1xkbt.png
Remember these co-ordinates or write them down
I will be referring to them as the left co-ordinates

Step 3: Drag your bird to wherever you want it to be on the right

Step 4: Check your bird's co-ordinates as shown below

This is where you find the co-ordinates
http://i49.tinypic.com/f1xkbt.png
Remember these co-ordinates or write them down
I will be referring to them as the right co-ordinates

Step 5: Drag your bird to wherever you want it's starting point to be

Step 6: Check your bird's co-ordinates as shown below

This is where you find the co-ordinates
http://i49.tinypic.com/f1xkbt.png
Remember these co-ordinates or write them down
I will be referring to them as the start co-ordinates

Step 7: Add this script

when gf clicked
go to x: (start co-ordinate x) y: (start co-ordinate y)
forever
point in direction (-90 v)
glide (1) secs to x: (left co-ordinate x) y: (left co-ordinate y)
point in direction (90 v)
glide (1) secs to x: (right co-ordinate x) y: (right co-ordinate y)
end
Just replace the variable blocks with you start co-ordinates, left co-ordinates and right co-ordinates

I hope I helped  big_smile

Last edited by Bailz_Gamer (2012-11-17 16:53:17)


▂▃▅▆▇█ B █ a █ i █ l █ z ██ G █ a █ m █ e █ r █▇▆▅▃▂
The Super Gaming Guy

Offline

 

#8 2012-11-17 17:12:40

Mik_Ael
New Scratcher
Registered: 2012-11-17
Posts: 15

Re: Coordinates of an object

Thanks again Ernie, I think I understand the coordinates stuff better now !

Wow, thanks for making me a tutorial so quickly Bailz_Gamer  big_smile  I'm trying it right now to see what method suits the bird best. You sure helped me here!!  big_smile 
I wanna help like that when I grow a little more used to Scratch  smile

Offline

 

#9 2012-11-17 17:20:43

Bailz_Gamer
Scratcher
Registered: 2010-12-04
Posts: 100+

Re: Coordinates of an object

Mik_Ael wrote:

Thanks again Ernie, I think I understand the coordinates stuff better now !

Wow, thanks for making me a tutorial so quickly Bailz_Gamer  big_smile  I'm trying it right now to see what method suits the bird best. You sure helped me here!!  big_smile 
I wanna help like that when I grow a little more used to Scratch  smile

No problem, happy to help  smile


▂▃▅▆▇█ B █ a █ i █ l █ z ██ G █ a █ m █ e █ r █▇▆▅▃▂
The Super Gaming Guy

Offline

 

#10 2012-11-17 17:54:53

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Coordinates of an object

Mik_Ael wrote:

Thanks again Ernie, I think I understand the coordinates stuff better now !

Wow, thanks for making me a tutorial so quickly Bailz_Gamer  big_smile  I'm trying it right now to see what method suits the bird best. You sure helped me here!!  big_smile 
I wanna help like that when I grow a little more used to Scratch  smile

Your welcome! And certainly, in the near future, you could be helping lots of scratchers.


http://i46.tinypic.com/35ismmc.png

Offline

 

#11 2012-11-17 22:27:24

Bailz_Gamer
Scratcher
Registered: 2010-12-04
Posts: 100+

Re: Coordinates of an object

OH YEAH I FORGOT
For smooth turning around costumes, click on the left/right arrow in this picture
http://i49.tinypic.com/f1xkbt.png


▂▃▅▆▇█ B █ a █ i █ l █ z ██ G █ a █ m █ e █ r █▇▆▅▃▂
The Super Gaming Guy

Offline

 

#12 2012-11-18 09:04:23

Mik_Ael
New Scratcher
Registered: 2012-11-17
Posts: 15

Re: Coordinates of an object

Thank you Bailz_gamer ! Thanks to all this help I can share my first project today  big_smile

Offline

 

Board footer