1) Is it possible to get an arrow to point towards the mouse pointer in etoys?
I can get it to point towards a box which is being moved with the mouse with this script: *arrow's heading <-- arrow's bearing to box*
In the world menu in the playfield pane there are mouse x and mouse y detectors but arrow's bearing will not accept those detectors as input to replace just the box part
2) I also wanted to detect a mouse click but can't see any way to do that. The input pane in the world menu detects last keystroke but not a mouse click.
For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
- Is it possible to get an arrow to point towards the mouse pointer in
etoys? I can get it to point towards a box which is being moved with the mouse with this script: arrow's heading <-- arrow's bearing to box In the world menu in the playfield pane there are mouse x and mouse y detectors but arrow's bearing will not accept those detectors as input to replace just the box part 2) I also wanted to detect a mouse click but can't see any way to do that. The input pane in the world menu detects last keystroke but not a mouse click. _______________________________________________ squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
You may have to write something like that
script1 self setHeading: (self costume referencePosition bearingToPoint: ActiveHand x @ ActiveHand y)
This example does not work yet, but you get the idea.
Hilaire
2009/11/11 Hilaire Fernandes hilaire.fernandes@edu.ge.ch:
For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
- Is it possible to get an arrow to point towards the mouse pointer in
etoys? I can get it to point towards a box which is being moved with the mouse with this script: arrow's heading <-- arrow's bearing to box In the world menu in the playfield pane there are mouse x and mouse y detectors but arrow's bearing will not accept those detectors as input to replace just the box part 2) I also wanted to detect a mouse click but can't see any way to do that. The input pane in the world menu detects last keystroke but not a mouse click. _______________________________________________ squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
For point 1 you can use the slope formula m = (y1-y2)/(x1-x2) and then arcTan m to get degrees.
arcTan may have to come from Smalltalk mode.
Cheers, Darius
On Tue, Nov 10, 2009 at 10:53 PM, Hilaire Fernandes < hilaire.fernandes@edu.ge.ch> wrote:
For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
- Is it possible to get an arrow to point towards the mouse pointer in
etoys? I can get it to point towards a box which is being moved with the mouse
with
this script: arrow's heading <-- arrow's bearing to box In the world menu in the playfield pane there are mouse x and mouse y detectors but arrow's bearing will not accept those detectors as input to replace just the box part 2) I also wanted to detect a mouse click but can't see any way to do
that.
The input pane in the world menu detects last keystroke but not a mouse click. _______________________________________________ squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
-- http://blog.ofset.org/hilaire _______________________________________________ squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
On Nov 10, 2009, at 11:02 PM, Darius Clarke wrote:
For point 1 you can use the slope formula m = (y1-y2)/(x1-x2) and then arcTan m to get degrees.
arcTan may have to come from Smalltalk mode.
Cheers, Darius
On Tue, Nov 10, 2009 at 10:53 PM, Hilaire Fernandes hilaire.fernandes@edu.ge.ch wrote: For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
- Is it possible to get an arrow to point towards the mouse pointer in
etoys?
FWIW I attach a working example... notice that it's all done with tiles -- no textual scripting.
-- Scott
On Wed, Nov 11, 2009 at 7:32 PM, Scott Wallace <scott.wallace@squeakland.org
wrote:
On Nov 10, 2009, at 11:02 PM, Darius Clarke wrote:
For point 1 you can use the slope formula m = (y1-y2)/(x1-x2) and then
arcTan m to get degrees.
arcTan may have to come from Smalltalk mode.
Cheers, Darius
On Tue, Nov 10, 2009 at 10:53 PM, Hilaire Fernandes <
hilaire.fernandes@edu.ge.ch> wrote:
For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
- Is it possible to get an arrow to point towards the mouse pointer in
etoys?
FWIW I attach a working example... notice that it's all done with tiles -- no textual scripting.
wonderful answers, thanks all
Attached below is another solution, using an invisible "sprite".
-- Scott
On Nov 11, 2009, at 1:02 AM, Scott Wallace wrote:
On Nov 10, 2009, at 11:02 PM, Darius Clarke wrote:
For point 1 you can use the slope formula m = (y1-y2)/(x1-x2) and then arcTan m to get degrees.
arcTan may have to come from Smalltalk mode.
Cheers, Darius
On Tue, Nov 10, 2009 at 10:53 PM, Hilaire Fernandes hilaire.fernandes@edu.ge.ch wrote: For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
- Is it possible to get an arrow to point towards the mouse pointer in
etoys?
FWIW I attach a working example... notice that it's all done with tiles -- no textual scripting.
-- Scott
<pointTowardCursor.002.pr>_______________________________________________ squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
On Wed, Nov 11, 2009 at 8:38 PM, Scott Wallace <scott.wallace@squeakland.org
wrote:
Attached below is another solution, using an invisible "sprite".
How did you make the invisible sprite Scott? I just clicked on your Sprite's show key and nothing appeared Is it just an empty drawing which you keep? I haven't tried that yet
I almost worked out that one myself after my intial post But I made a visible sprite and then shrunk it - it sort of worked but because the sprite was visible once it was ticking I couldn't use the mouse to switch off the clock or anything else because the sprite got in the way
-- Scott
On Nov 11, 2009, at 1:02 AM, Scott Wallace wrote:
On Nov 10, 2009, at 11:02 PM, Darius Clarke wrote:
For point 1 you can use the slope formula m = (y1-y2)/(x1-x2) and then
arcTan m to get degrees.
arcTan may have to come from Smalltalk mode.
Cheers, Darius
On Tue, Nov 10, 2009 at 10:53 PM, Hilaire Fernandes <
hilaire.fernandes@edu.ge.ch> wrote:
For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
- Is it possible to get an arrow to point towards the mouse pointer in
etoys?
FWIW I attach a working example... notice that it's all done with tiles
-- no textual scripting.
-- Scott
<pointTowardCursor.002.pr _______________________________________________ squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
On Nov 11, 2009, at 2:20 AM, Bill Kerr wrote:
On Wed, Nov 11, 2009 at 8:38 PM, Scott Wallace scott.wallace@squeakland.org wrote:
Attached below is another solution, using an invisible "sprite".
How did you make the invisible sprite Scott? I just clicked on your Sprite's show key and nothing appeared Is it just an empty drawing which you keep? I haven't tried that yet
I almost worked out that one myself after my intial post But I made a visible sprite and then shrunk it - it sort of worked but because the sprite was visible once it was ticking I couldn't use the mouse to switch off the clock or anything else because the sprite got in the way
Heh, heh... The sprite is a tiny RectangleMorph, which is:
(a) Invisible -- color transparent, borderWidth 0. (b) Locked -- so that the sprite doesn't get in the way of mouse use.
-- Scott
On Wed, Nov 11, 2009 at 9:11 PM, Scott Wallace <scott.wallace@squeakland.org
wrote:
On Nov 11, 2009, at 2:20 AM, Bill Kerr wrote:
On Wed, Nov 11, 2009 at 8:38 PM, Scott Wallace <
scott.wallace@squeakland.org> wrote:
Attached below is another solution, using an invisible "sprite".
How did you make the invisible sprite Scott? I just clicked on your Sprite's show key and nothing appeared Is it just an empty drawing which you keep? I haven't tried that yet
I almost worked out that one myself after my intial post But I made a visible sprite and then shrunk it - it sort of worked but
because the sprite was visible once it was ticking I couldn't use the mouse to switch off the clock or anything else because the sprite got in the way
Heh, heh... The sprite is a tiny RectangleMorph, which is:
(a) Invisible -- color transparent, borderWidth 0. (b) Locked -- so that the sprite doesn't get in the way of mouse use.
thanks
btw if you close the viewer of an invisible sprite is it possible to get it back?
I had that problem last week when a student was making a lunar lander disappear by hiding it then he inadvertently closed the viewer and we couldn't work out how to get it back so he lost his work
-- Scott_______________________________________________ squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
Shift-clic in the background display a menu with the list of morh ?
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
btw if you close the viewer of an invisible sprite is it possible to get it back? I had that problem last week when a student was making a lunar lander disappear by hiding it then he inadvertently closed the viewer and we couldn't work out how to get it back so he lost his work
On 11.11.2009, at 12:13, Bill Kerr wrote:
On Wed, Nov 11, 2009 at 9:11 PM, Scott Wallace scott.wallace@squeakland.org wrote: On Nov 11, 2009, at 2:20 AM, Bill Kerr wrote:
On Wed, Nov 11, 2009 at 8:38 PM, Scott Wallace scott.wallace@squeakland.org wrote:
Attached below is another solution, using an invisible "sprite".
How did you make the invisible sprite Scott? I just clicked on your Sprite's show key and nothing appeared Is it just an empty drawing which you keep? I haven't tried that yet
I almost worked out that one myself after my intial post But I made a visible sprite and then shrunk it - it sort of worked but because the sprite was visible once it was ticking I couldn't use the mouse to switch off the clock or anything else because the sprite got in the way
Heh, heh... The sprite is a tiny RectangleMorph, which is:
(a) Invisible -- color transparent, borderWidth 0. (b) Locked -- so that the sprite doesn't get in the way of mouse use.
thanks
btw if you close the viewer of an invisible sprite is it possible to get it back?
I had that problem last week when a student was making a lunar lander disappear by hiding it then he inadvertently closed the viewer and we couldn't work out how to get it back so he lost his work
Use the "Players" tool from the supplies flap.
Instead of a transparent rectangle you also can just use a small sketch and click its "hide" tile (and e.g. make buttons to show and hide for debugging).
- Bert -
Ah, I found your blog entry now. Attached is a project that I think does what you wanted - I did not hide the dots, would be simple though.
This task is a bit geared towards Scratch - it's more complicated in Etoys as there is no reification of the mouse pointer. Might be a nice idea to make a player for it though ...
- Bert -
On Thu, Nov 12, 2009 at 2:54 AM, Bert Freudenberg bert@freudenbergs.dewrote:
Ah, I found your blog entry now. Attached is a project that I think does what you wanted - I did not hide the dots, would be simple though.
This task is a bit geared towards Scratch - it's more complicated in Etoys as there is no reification of the mouse pointer. Might be a nice idea to make a player for it though ...
Nice project Bert, thanks
In reconstructing what you did I found out 1) that if I put the mouseDown script (click script) that moves the target object to the mouse object into the target script then it didn't work, it required a world script - not sure whether that is a bug or a feature (that you need a world script to detect a click on the world)
2) this line was tricky to build: arrow's distance to target > 20 (a) ie. I found arrow's distance to dot in the observation pane and replaced the dot with a target - but then there were no option for a > extension At that stage I would have given up but since you had done it then it had to be possible (b) So I then found an arrow's distance with an assignment handle in the geometry pane and then found I could replace the arrow's distance part with the arrow's distance to target built in (a)
- Bert -
On 15.11.2009, at 11:42, Bill Kerr wrote:
On Thu, Nov 12, 2009 at 2:54 AM, Bert Freudenberg bert@freudenbergs.de wrote: Ah, I found your blog entry now. Attached is a project that I think does what you wanted - I did not hide the dots, would be simple though.
This task is a bit geared towards Scratch - it's more complicated in Etoys as there is no reification of the mouse pointer. Might be a nice idea to make a player for it though ...
Nice project Bert, thanks
In reconstructing what you did I found out
that if I put the mouseDown script (click script) that moves the target object to the mouse object into the target script then it didn't work, it required a world script - not sure whether that is a bug or a feature (that you need a world script to detect a click on the world)
this line was tricky to build:
arrow's distance to target > 20 (a) ie. I found arrow's distance to dot in the observation pane and replaced the dot with a target - but then there were no option for a > extension At that stage I would have given up but since you had done it then it had to be possible (b) So I then found an arrow's distance with an assignment handle in the geometry pane and then found I could replace the arrow's distance part with the arrow's distance to target built in (a)
When I drop a distance-to tile into the test tile, it appends the "<" comparison automatically.
Oh, I remember now. This was a bug, is fixed in Etoys 4.0.2329:
http://tracker.squeakland.org/browse/SQ-495
- Bert -
Scott Wallace wrote:
Attached below is another solution, using an invisible "sprite".
Scott, it is great that you uploaded the projects with your solution to the showcase! This is a great way to keep ideas like this and make it available for everyone.
Rita
-- Scott
On Nov 11, 2009, at 1:02 AM, Scott Wallace wrote:
On Nov 10, 2009, at 11:02 PM, Darius Clarke wrote:
For point 1 you can use the slope formula m = (y1-y2)/(x1-x2) and then arcTan m to get degrees.
arcTan may have to come from Smalltalk mode.
Cheers, Darius
On Tue, Nov 10, 2009 at 10:53 PM, Hilaire Fernandes hilaire.fernandes@edu.ge.ch wrote: For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
Hilaire
2009/11/11 Bill Kerr billkerr@gmail.com:
- Is it possible to get an arrow to point towards the mouse pointer in
etoys?
FWIW I attach a working example... notice that it's all done with tiles -- no textual scripting.
-- Scott
<pointTowardCursor.002.pr>_______________________________________________ squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
I was meaning point1
Hilaire
2009/11/11 Hilaire Fernandes hilaire.fernandes@edu.ge.ch:
For point 2., you may have to write the script in Smalltalk mode then use the code
ActiveHand x to get abscissa of the mouse pointer
squeakland@lists.squeakfoundation.org