Closed HugopGhost closed 7 years ago
You can develop your own parser e.g. in custom block. For example block motion program %code with args %mlt%s
or in blocks grammar motion program [multiline] with args [] [] []...
Hi @HugopGhost , I'm curious to learn more about this idea / feature request. Can you perhaps tell us of an example what you'd like to be able to accomplish? Thanks!
What do you mean, like switching the the way point in direction
works? If you wanted to use a different coordinate system you could make your own custom blocks - but they wouldn't "replace" the built in ones. (However, you could use the hide function to not show them to students.)
Do you want a DSL for moving?
Hi, I am talking about the codification example to turn Snap blocks into Python/JS/C/Smalltalk. The motion tab is empty, and many other blocks seem to be missing.
Oh. In the sample project, Jens just made translations for the blocks he needed for the FizzBuzz example. Snap! just provides the ability to do codification; it's up to users to provide whatever translations they like.
You're right that it'd be straightforward to translate motions into other languages, but not so easy to provide the context in which motions happen in Snap!: multiple sprites, costumes, animated moving (glide). Providing a full translation for every Snap! feature would be really hard; that's one reason why we leave it up to the users to decide what features they need for their application.
Here's a good example of converting the motion blocks to Python's Turtle graphics module.
https://github.com/cs10/bjc.py
The XML file can be imported into Snap! and the snap.py file contains functions that cleaning expose some of the differenes between Snap! and python. (It should be pasted into the XML file so it's included in the output of the code
block.
I think it would be nice to be able to turn motions (xy coordination system) into a different language.
I am not an expert on this, but I assume it is easy for a few languages like Python. Couldn't find this noted as issue, sorry if it is a duplicate. If it is, please link me to it, I would like to know the problems of making this possible.