Documentation about pens and looks

This is the place to ask question about Enchanting, talk about your Enchanting projects or simply find out more about Enchanting on the NXT.

Moderator: clintonb

cayhorstmann
New User
Posts: 1
Joined: Tue Jan 06, 2015 2:47 pm

Documentation about pens and looks

Postby cayhorstmann » Tue Jan 06, 2015 2:55 pm

Hi, I can't figure out what to expect from the pen. I am trying out the sparkline program from card 9, and no spark line shows up. Instead, I get the genie sprite.

How are the pen commands supposed to work? Are x and y magic variables? Is a line drawn whenever they change??? And what is "stamp"? Sadly, trying any of them in a sample program shows exactly nothing other than that annoying genie.

And what's a sprite anyway? Why does my program code go away when I remove it? And what's a "costume"?

And, while I am at it, what is the difference between "show" and "print"?

Thanks,

Cay

clintonb
Active User
Posts: 138
Joined: Fri May 28, 2010 1:44 am
Location: Cardston, Alberta, Canada
Contact:

Re: Documentation about pens and looks

Postby clintonb » Thu Jan 22, 2015 2:16 pm

Hi Jan.

Enchanting builds on Scratch; it tries to take a model that many children understand, and adapt it to robots. A lot of these things can be played with more easily using Scratch.

A sprite is anything that can move around on the screen. A default Enchanting project starts with one sprite; it looks like a robot floating in mid-air. You can use commands to move it around on the screen (which in turn change the results you get when looking at the 'x' and 'y' variables), you can make it 'say' things, etc. A sprite can have multiple costumes; use the 'next costume' to change between them. If you were to, say, add a sprite from a file and use a bat image with wings up, and then go to the costumes, and add a second image, the bat with the wings down, then, should you switch costumes, the sprite would animate.

If you issue a 'pen down' command, then whenever you move the sprite on the screen, it'll leave a line behind. If you tell it to 'stamp', it'll leave its image behind on the screen's background (and if you move it, there'll be more than one image of it, but only one will move.) You can also 'clear' the background to remove all lines and stamps.

Each sprite can have its own code. You can duplicate and sprite, and duplicate the code. If you delete the sprite, the code you've attached to it goes away. By default, you edit the code on the first sprite. If you prefer, everything that is not sprite-related still works if you attach the program to the 'stage' instead of one of the sprites.

'say' makes text come out beside a sprite, as though it was a comic-book character speaking it. If you say something different, the text is replaced and only shows the last thing said. It is very useful for showing the current value of something.
'print' puts some text on the screen and stamps it there; subsequent print commands will be on the next line. It is invaluable for showing how a value has changed over time (although the sparkline may be a better representation -- it just takes more work).

Again, do try out Scratch. Enchanting makes a lot less sense without understanding it.

Cheers,
Clinton


Return to “Enchanting Questions and Projects”

Who is online

Users browsing this forum: No registered users and 1 guest