Movement oddity...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Movement oddity...

Blake-5
Hello, again:

        I've found an oddity with a simple script. I've attached a JPG of the  
script, which is the only one I've created in the image. Basically, the  
object is to track the mouse. If its X/Y is not equal to the mouse's X/Y  
it changes its own X/Y by one.

        If I set the script to fire an even number of times per second, it works.

        If I set it to fire an odd number of times, it bobbles. It goes to the  
right place, then moves off it by one, then goes to the right place.

        As if the update of the X/Y occurs out of synch with the event firing.

        ?

        ===Blake===
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland

script.jpg (53K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Movement oddity...

Jerome Peace
Hi Blake,

Great job finding oddities. Keep up the good work.

The key to the movement oddity is in the width and
heigth of the morph. The etoy x and y of the morph are
the center or nearly the center. Which means that when
the morph has an odd width or in this case heigth
either the corner or the center will not be on an
integer boundry. World's mouse x and mouse y are the
cursor point. And that is always integer. Obviously,
somehow, this is causing the inequality to fail after
the morph has been moved. And so it will adjust one
way at one tick and the other way at the next.

If there are an even number of ticks. It will bobble
twice as much but end up in the same place each time
its displayed. We don't see it.

A work around is to adjust your morphs width and
height so that they are both even and then the morph
will be rock steady when it gets to the cursor point.

A good way to demostrate the relationship would be to
use a ruler morph as the test morph. And try it with
different heights and widths.



Yours in service, -- Jerome Peace


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Movement oddity...

Jerome Peace
In reply to this post by Blake-5
Hi Blake,

--- Blake <[hidden email]> wrote:

> Thanks, Jerome!
>
> Any thoughts on detecting mouse clicks?
>
> ===Blake===

 
Sure since you asked.

First, I need some more info. When you say mouse
clicks what are you talking about?

I know this sounds silly but I have a good reason for
asking. In Etoys you can set a script to be run on
mouse down or mouse up. Which should do for many
applications.

In the innards of squeak you can make distinctions
between click (an uninterupted mouse down, mouse up
sequence), double click ( two uninterupted sequences),

a startdrag interuption, and a timeout interuption.  

AFAIK eToys does not provide for the latter so one
needs to get by with the former.

The innards also provide for checking on whether the
red (left) yellow ( right ) or  ( blue ) button was
pressed . Etoys does not provide a way to test which
button AFAIK. Someone else may know more about the
etoy capabilities.  I got lured to the innards side of
squeak after getting frustrated by the limitations of
early etoys.

So, knowing this can you describe what you wish to
achieve more precisely?

Yours in service, -- Jerome Peace


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland