hi all, I have created an rectangle morph and a small ellipse morph. I want to place the ellipse in the rectangle and move the small ellipse(circle) in the direction of the mouse pointer. I want the small ellipse does not come out of the rectangle but small ellipse should be moving with respect to direction of the mouse just as movingeyemorph making the ellipse stay at one place move with in the direction of mouse .can anyone help me make this happen
On Nov 18, 2006, at 2:54 , mnrao wrote:
hi all, I have created an rectangle morph and a small ellipse morph. I want to place the ellipse in the rectangle and move the small ellipse (circle) in the direction of the mouse pointer. I want the small ellipse does not come out of the rectangle but small ellipse should be moving with respect to direction of the mouse just as movingeyemorph making the ellipse stay at one place move with in the direction of mouse .can anyone help me make this happen
You can access the x and y of the mouse pointer in the world's viewer. You have access to the x and y and width and height of the rectangle, as well as to the width and height of the ellipse. You can move the ellipse by setting its x and y. Other than that, it's just some math.
- Bert -
Bert Freudenberg wrote:
Other than that, it's just some math.
For this kind of thing (something like the eyes that follow your mouse) would it just be math (calculating a certain distance from the center of the object you're over) or would use an objects "colorUnder" at all?
After playing with "colorUnder" in some experiments last night, I'm leaning toward math, but I'd prefer to hear it from an expert. I'd prefer it so I could also ask: what kind of situation is "colorUnder" best used for?
beginners@lists.squeakfoundation.org