I made a program for testing the alignment of the pen and the touching-color sensor:
http://scratch.mit.edu/projects/kevin_karplus/10057
This indicates that the java implementation is correctly aligned, but the squeak implementation has a rather nasty off-by-one error in both x and y.
(The off-by-one error is why the arrays for the Simon game needed big pens:
http://scratch.mit.edu/projects/kevin_karplus/2158
)
Offline
Ahh... Perhaps that explains some of the behaviour in my Dancing Angels game.
Every angle checks to see if it is touching the black outline of another angel, and if it is, it hides. In theory, then, angles would always disappear in pairs, but in practice, sometimes one gets left behind.
If one of them is sensign the wrong "spot", perhaps that's why.
Last edited by Mayhem (2007-06-04 12:32:27)
Offline
There's not just a difference in sensing, drawing is somehow off too.
In my Artillery project...
http://scratch.mit.edu/projects/slobasso/8547
I had to move the fort sprites down one pixel because they appeared to be floating above the landscape in the JAVA version.
Offline
I did not test to see whether the error was in drawing or in sensing. Either or both could be off. Icould write a test that distinguishes the two---I'll see if I have time tomorrow.
Offline
I wrote a new test program
http://scratch.mit.edu/projects/kevin_karplus/11090
that determines that the problem is *not* with the touching-color block, but with the pen being offset.
Both the Java and the Squeak implementations have a range of (-240,-179) to (239,180)
which seems like a strange choice, since I would have expected either
(-240,-180) (240,180) (for a 481x361 stage)
or (-240,-180) (239, 179) (for a 480x360 stage)
Offline
It looks like the squeak version is doing the weird thing here of taking any fractional amount as a reason to move the sprite another pixel. A coordinate of 48 and 48.1 should probably produce the same visual position (this is what Java does). But the squeak version moves it.
Offline
It is (probably) not just rounding errors, as even specifying integer positions causes the pen to be off by (-1,1) from the sprite.
Offline
The problem still seems to be around in 1.4 (squeak). Drawing a horizontal line at y=180 does nothing, but at y=179, the line appears at y=178. Which is weird, since I would have expected y=180 to draw a line at y=179....
Offline