go to and set x blocks

Report bugs. Post bug workarounds or fixes

Moderator: MSandro

Post Reply
vickiS
Posts: 7
Joined: Oct 5th, '17, 16:26
Contact:

go to and set x blocks

Post by vickiS » Oct 5th, '17, 17:36

Hi. I am running the latest version (75) on Windows 10. I am having trouble with the values reported after using the go to and set x position blocks when x is set to zero. For example if I set x to 0 and y to 150 the instance moves to the correct location on screen but the x position reporter and monitor report -2.75536e-014. y reports as 150.0. If both x and y are set to 0 either with go to or set x and set y the instance reports both positions as 0.0 as expected. I've tried all kinds of different values and just now I tried moving the instance around with the mouse and the monitors are inconsistent. I get values with one decimal or no decimal and occasional long values as described above for x or y. I tried restarting GP to see if it's just my session that's messed up but that didn't help.

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: go to and set x blocks

Post by JohnM » Oct 6th, '17, 21:09

It's normal for GP to return floating point values for the X and Y position. This is because the stage is "scaled" so the underlying representation of positions is floating point numbers.

If you're prefer to work with integer coordinates, you could add two instance variables, "x" and "y", and add a script like the following:
Screen Shot 2017-10-06 at 5.07.31 PM.png
This script will set the x and y instance variables to the nearest integer coordinates.

vickiS
Posts: 7
Joined: Oct 5th, '17, 16:26
Contact:

Re: go to and set x blocks

Post by vickiS » Oct 7th, '17, 05:00

Thanks. I was trying to capture screen coordinates in lists and was surprised by the results. Wrapping with a round block works fine.

Post Reply