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

#1 2012-10-18 00:54:20

naiad_diana
New Scratcher
Registered: 2012-10-17
Posts: 7

How do I get the programmatically get the value of my x and y position

Is there a way to programmatically get the value of my x and y position?
I want to know which side my object is - whether it's at the right, left, or bottom edge of the stage.

Offline

 

#2 2012-10-18 01:34:52

naiad_diana
New Scratcher
Registered: 2012-10-17
Posts: 7

Re: How do I get the programmatically get the value of my x and y position

I found it! Yey!
It's in Sensing.

Offline

 

#3 2012-10-18 02:29:18

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: How do I get the programmatically get the value of my x and y position

Actually, you use the (x position) and (y position) blocks under Motion.  wink


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#4 2012-10-18 03:31:17

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: How do I get the programmatically get the value of my x and y position

Hardmath123 wrote:

Actually, you use the (x position) and (y position) blocks under Motion.  wink

If you want to get the position of your own sprite you use the ones in motion or sensing.
If you want to get the position of another sprite, you have to use the block in sensing.

Offline

 

#5 2012-10-18 05:38:02

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: How do I get the programmatically get the value of my x and y position

Right. But he said "my" position, which somehow implies the same sprite's.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6 2012-10-18 06:20:42

naiad_diana
New Scratcher
Registered: 2012-10-17
Posts: 7

Re: How do I get the programmatically get the value of my x and y position

Thank you for the help.
I posted another question regarding a script to repel 2 sprites when they touch.

Offline

 

Board footer