Closed nathalierun closed 8 years ago
If it's answer for your question, point towards 0
sets direction to the right
No, I already understood the four directions 0, 90, -90 and 180. You don't understand my request.
Here is my script. It does not work at all.
Ouch, now I get it, but I'm not on the computer now, so I can't help you at the moment.
BTW -90 and 270 are the same, because it's doing degrees % 360
.
https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/blob/master/objects.js#L3805
Always you can debug it with visible stepping
Fantastic ! Thank you for the link ! Really. Because, I wondered wether rotations were wrote on Snap!
I thank you alsow for the visible stepping because I didn't know how to go step by step.
I'm glad I helped.
Tangent is not an invertible function -- different angles can have the same tangent. The arctangent function has to pick one of them to report, and by convention it picks rightward-pointing values, in the range -90 to 90 degrees, using the standard math angle measure (counterclockwise from east). To get to the Snap! angle measure (clockwise from north), compute 90-atan(∆y/∆x), which gets you values between 0 and 180 degrees. Then you do have to check for wanting to point leftward, ∆x<0, in which case you add 180 degrees to the angle you have. But I don't think you also have to worry about whether the value returned by atan is positive or negative.
The way I implemented it is like this: (Supposing the first item on the lists is the x position, and the second the y)
Since atan does not now the difference between -x/y x/-y, nor does it know the difference between -x/-y and x/y, this only checks if the height of the triangle the coords form is negative, and if it is it adds 180 to the angle (Try never adding 180 and you'll see why)
An alternative comment...
If I don't want to work with trigonometric functions with my pupils (in this time), I can use Snap! environment to achieve it. I only need a hidden Sprite to help me: I move this sprite to (x,y) coord and then, I can point to it.
Thank you for this answer. I didn't know at all that it was possible to do such action with a sprite. So, I wonder wether it was possible to do it with clones. And so, how can I do it ?
Because, how do you create your HiddenSprite ? I think that you have to do it manually : I mean that you have to duplicate the actual sprite and to rename it to do it. It is not possible to do that if you want to run automatically the processus.
Yes, you can totally use a hidden clone for this! I'm sorry the official website isn't very user-friendly or structured better. Here's a link to my documentation about first-class sprites (including clones) that has all the information:
http://snap.berkeley.edu/snapsource/FirstClassSpritesInSnap.pdf
... but there's no reason it has to be a clone. You can just have one sprite, with a tiny invisible costume, that's used only for this purpose:
Hi, @jmoenig This document about FirstClassSprites is greatl!! @nathalierun You have many options... depends on other aspects of your project. For example, you can create a clone, use this to point the direction and kill it:
So, I really have choice ! Thank you to all of you.
But I realize that I have really a lot of work to do to progress.
I wondered whether there were such things as summer university on Snap! on july 2017 in Berkeley, or more simply, would it be possible to join your team, in your labs, just for one or two weeks in july. I promise not to disturb you. I just want to progress and be able to do some Snap!
non-stop
during one or two weeks, with the possibility of asking you some questions, sometimes. I feel that your soft will become very useful in mathematics education an I am enough crazy to perform the travel from Reunion Island (french department) to come to a summer university.
I have another question : is Snap! on Twitter ? my link on Twitter is @nathrune
Nathalie Carrié, french mathematic teacher http://irem.univ-reunion.fr/spip.php?auteur8
No, Snap ! isn't on Twitter.
There's a couple twitter accounts for Snap! stuff:
@SnapCloud
is run by Miosoft
@moenig
is Jens' account
@cspbjc
is the official for BJC which includes Snap! (and other CS) stuff
We'll be running BJC workshops in July at Berkeley. That's not exactly the same as a Snap! workshop, but there's plenty of Snap! stuff in it. Look on http://bjc.berkeley.edu for information.
PS There isn't exactly a lab in the sense I think you mean. The work gets done 95% at Jens's house, and the rest some combination of Bernat's house and Michael's house and my house.
It's a distributed, concurrent, time-sharing lab with offices in three different countries!
@bromagosa : So ? Concurrent ? What do you mean ? Should I do a BJC summer course or not ?
@brianharvey : I understand know how your team is working. Effectively, it would be a problem to come to your development laboratory, seeing that you develop at home ;-(
Oh, it was just a joke! :)
You'd love the BJC course, so if you can attend, do it!
Ok, Thank you. I'll see.
@brianharvey : definitely, I do not understand how to reproduce this : https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/issues/1510#issuecomment-260343321 What is your
pointer sprite
A text or a sprite ???
Pointer sprite is a sprite with name pointer sprite
(in example).
You make a sprite, name it "pointer sprite" (or anything, of course, will work), have it HIDE so you don't ever see it, and then the code I posted will work for pointing to any coordinates on the stage.
@brianharvey : No, I still can't reproduce.
Ah, you'll need to drag in the point towards block from Sprite to get it to have the option of SpriteH.
Some of the motion blocks are tied to the sprite they came from.
Admittedly, you should probably be able to point towards the same sprite and it would just be a no-op.
Michael Ball From my iPhone michaelball.co
On Nov 17, 2016, at 7:35 PM, Nathalie Carrié notifications@github.com wrote:
@brianharvey : No, I still can't reproduce.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Ok, thanks. But it does not work.
The gray Sprite doesn't point towards SpriteH.
Are you sure you are using the block in Sprite, not SpriteH?
Hmm. I thought that should have worked.
If you wrap another TELL block around the point towards then I think it should work.
Michael Ball From my iPhone michaelball.co
On Nov 17, 2016, at 7:54 PM, Nathalie Carrié notifications@github.com wrote:
Ok, thanks. But it does not work.
The gray Sprite doesn't point towards SpriteH.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
@Jonathan50 : That's it ! Thank you.
No, that's not necessary. In your picture above, it's not working because you have SpriteH selected in the sprite corral (see bottom right corner of screen), and so that's the one you're telling to LOOK AT. You need to select the sprite that you're trying to turn! Then use LOOK AT in that sprite.
Yes @brianharvey . Thank you. I just saw my error.
Hello,
I have some problem to create a move fonction wich allows to have the pointer direction towards a point.
Would it be possible to have the possibility to "Point towards" a point (with its coordinates), or to have a function such as : directionFromA.To.B where A and B are lists of coordinates ?
I have problems with the function arctan to do it. The direction is correct just 1 time to 4...
The direction goes from 0 to 180. And after, how it works ? -90 is it equal to 270 ?
Thank you for your answer. Nathalie Carrie, a french teacher.