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.
_______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
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 <[hidden email]>: > 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. > _______________________________________________ > squeakland mailing list > [hidden email] > http://lists.squeakland.org/mailman/listinfo/squeakland > > -- http://blog.ofset.org/hilaire _______________________________________________ squeakland mailing list [hidden email] 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 <[hidden email]>: > 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 <[hidden email]>: >> 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. >> _______________________________________________ >> squeakland mailing list >> [hidden email] >> http://lists.squeakland.org/mailman/listinfo/squeakland >> >> > > > > -- > http://blog.ofset.org/hilaire > -- http://blog.ofset.org/hilaire _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Hilaire Fernandes
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 <[hidden email]> wrote: For point 2., you may have to write the script in Smalltalk mode then _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Hilaire Fernandes
I was meaning point1
Hilaire 2009/11/11 Hilaire Fernandes <[hidden email]>: > 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 mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Darius Clarke
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 <[hidden email]> 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 <[hidden email]>: > > 1) 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 _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland pointTowardCursor.002.pr (100K) Download Attachment |
On Wed, Nov 11, 2009 at 7:32 PM, Scott Wallace <[hidden email]> wrote:
wonderful answers, thanks all _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Bill Kerr
Hi,Bill You'll find the tiles mouseX and mouseY in the playfield category of a playfield or of the world. get an arrow fom object catalog/graphics move the ble rotation handle sligtly to make te center or rotation visible and move it shift/drag to the foot of the arrow. get the viewer of the arrow category polygon, et the arrow's vertex .cursor to 2 (head of the arrow). now just build the tiles : arrow's x at cursor _ playfield's mousex arrow's y at cursor _ playfield's mousey You probably just need to find where the tiles mouse and mousey were lying, but this will help other people. Regards -----Original Message----- From: "Hilaire Fernandes" [[hidden email]] Date: 11/11/2009 02:51 AM To: "Bill Kerr" <[hidden email]> CC: "squeakland.org mailing list" <[hidden email]> Subject: Re: [squeakland] point towards the mouse? 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 <[hidden email]>: > 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 <[hidden email]>: >> 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. >> _______________________________________________ >> squeakland mailing list >> [hidden email] >> http://lists.squeakland.org/mailman/listinfo/squeakland >> >> > > > > -- > http://blog.ofset.org/hilaire > -- http://blog.ofset.org/hilaire _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland
_______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Scott Wallace
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 <[hidden email]> 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 <[hidden email]>: >>> 1) 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 > [hidden email] > http://lists.squeakland.org/mailman/listinfo/squeakland _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland pointToCursor2.001.pr (54K) Download Attachment |
On Wed, Nov 11, 2009 at 8:38 PM, Scott Wallace <[hidden email]> 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
_______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Scott Wallace
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 <[hidden email]> 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 <[hidden email]>: >>> >>>> 1) 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 >> [hidden email] >> http://lists.squeakland.org/mailman/listinfo/squeakland >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> squeakland mailing list >> [hidden email] >> http://lists.squeakland.org/mailman/listinfo/squeakland -- Rita Freudenberg Squeakland Foundation http://www.squeakland.org _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Bill Kerr
On Nov 11, 2009, at 2:20 AM, Bill Kerr wrote:
> On Wed, Nov 11, 2009 at 8:38 PM, Scott Wallace <[hidden email]> 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_______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by p.a.dreyfuss@excite.com
On Wed, Nov 11, 2009 at 8:09 PM, [hidden email] <[hidden email]> wrote:
I've had a go at your instructions Pierre and learnt a few new things but haven't been totally successful with the pointing
btw I just wanted pointing at this stage not moving to the mouse as well a worked example would be great if you have the time regards _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Scott Wallace
On Wed, Nov 11, 2009 at 9:11 PM, Scott Wallace <[hidden email]> wrote:
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
_______________________________________________ squeakland mailing list [hidden email] 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 <[hidden email]>: > 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 _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Bill Kerr
On 11.11.2009, at 12:13, Bill Kerr wrote:
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 - _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
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 - _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland targetMouse.001.pr (74K) Download Attachment |
On Thu, Nov 12, 2009 at 2:54 AM, Bert Freudenberg <[hidden email]> 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. 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)
_______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
On 15.11.2009, at 11:42, Bill Kerr wrote:
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: - Bert - _______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland |
Free forum by Nabble | Edit this page |