| 1 |
\documentclass[a4paper,11pt]{article} |
| 2 |
\usepackage{array} |
| 3 |
\usepackage{multirow} |
| 4 |
\usepackage{lastpage} |
| 5 |
\usepackage{verbatim} |
| 6 |
\usepackage[francais,english]{babel} |
| 7 |
\usepackage[utf8]{inputenc} |
| 8 |
\usepackage[T1]{fontenc} |
| 9 |
\usepackage{tikz} |
| 10 |
\usetikzlibrary{calc} |
| 11 |
\usepackage{amsfonts,amsmath,amssymb,mathrsfs,amsthm} |
| 12 |
\usepackage{fancyhdr} |
| 13 |
\usepackage{lmodern} |
| 14 |
\usepackage{ScratchX} |
| 15 |
|
| 16 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 17 |
%----------------------------------- SI ALORS TOUTE BLANCHE----------------------------------------------------------- |
| 18 |
\newcommand{\whitesailors}[2]{%loop with as many blocks as we want |
| 19 |
% Créer un compteur à chaque passage dans cette boucle. % l'incrémenter du nombre de fois où ce décalage s'opère |
| 20 |
% décaler en abscisse : ajouter 0,4 à x % mettre le compteur NbreComptr à NbreComptr+1 |
| 21 |
\ifthenelse{\value{NbrCptrLoupeDuplicate}=0}%aucun compteurs loupe créés |
| 22 |
{ |
| 23 |
\ifthenelse{\value{CompteurMax}=0} |
| 24 |
{\loope{\theNbrCptrLoupe}{#2}} |
| 25 |
{ |
| 26 |
\ifthenelse{\value{NbrCptrLoupe}<\value{CompteurMax}}%\or\value{NbrCptrLoupe}=\value{CompteurMax}} |
| 27 |
{\looope{\theNbrCptrLoupe}{#2}} |
| 28 |
{\loope{\theNbrCptrLoupe}{#2}}%pour ne pas recréer des compteurs déjà créés |
| 29 |
} |
| 30 |
} |
| 31 |
{\looope{\theNbrCptrLoupe}{#2}} |
| 32 |
|
| 33 |
\ifthenelse{\value{NbrCptrAlorsDuplicate}=0}%aucun compteurs aloors créés |
| 34 |
{\sialoors{#1}} |
| 35 |
{\sialooors{#1}}%pour ne pas recréer des compteurs déjà créés |
| 36 |
\settowidth{\malongueuR}{\pgfinterruptpicture #1 \endpgfinterruptpicture} |
| 37 |
|
| 38 |
\FPeval{X}{\x+(0.4)*\thedecalageX} |
| 39 |
\FPeval{Y}{\y+(neg 0.66)*(\thedecalageY)} |
| 40 |
|
| 41 |
%\StrLen{#1}[\valeur]% pour ajuster la longueur de la boîte en fonction de la longueur du text |
| 42 |
\FPeval{b}{neg 0.1+Y}\FPeval{c}{0.36+Y}\FPeval{d}{0.1+X} |
| 43 |
\FPeval{e}{0.46+Y}\FPeval{f}{0.4+X}\FPeval{g}{0.5+X}\FPeval{h}{0.7+X}\FPeval{i}{0.8+X}\FPeval{j}{0.7+(X)} |
| 44 |
\FPeval{ii}{1.2+X}\FPeval{iii}{1.1+X}\FPeval{iiii}{0.9+X}\FPeval{gg}{0.6+X} |
| 45 |
\FPeval{l}{neg 0.2+(Y)}\FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} |
| 46 |
%top |
| 47 |
%bottom#1 |
| 48 |
\FPeval{mm}{neg 0.1+(neg 0.66)*(#2)+(Y)} |
| 49 |
\FPeval{mmm}{neg 0.2+(neg 0.66)*(#2)+(Y)}\FPeval{mmmm}{neg 0.3+(neg 0.66)*(#2)+(Y)}\FPeval{M}{neg 0.75+(neg 0.66)*(#2)+(Y)}\FPeval{MM}{neg 0.85+(neg 0.66)*(#2)+(Y)}\FPeval{MN}{neg 0.95+(neg 0.66)*(#2)+(Y)}\FPeval{MMM}{neg 0.55+(neg 0.66)*(#2)+(Y)}\FPeval{MMMM}{MMM-0.02}\FPeval{JJ}{j+0.02}%adjusting the height of the bottom |
| 50 |
\coordinate (A) at ($(\d,\e) ! \malongueuR ! (\f,\e)$); |
| 51 |
\coordinate (AA) at ($(\X,\c) ! \malongueuR+0.2cm ! (\g,\c)$); |
| 52 |
\coordinate (BB) at ($(\X,\M) ! \malongueuR+0.2cm ! (\f,\M)$); |
| 53 |
\coordinate (B) at ($(\g,\mmm) ! \malongueuR-0.4cm ! (\i,\mmm)$); |
| 54 |
|
| 55 |
\multido{\i=1+1}{\value{NbrCptrLoupe}}{%Fait défiler tous les compteurs jusqu'au nombre de compteurs : si compteur différent de -1 : |
| 56 |
% si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. |
| 57 |
\ifthenelse{\value{loupe\i}>-1}{ |
| 58 |
\ifthenelse{\value{loupe\i}=0} |
| 59 |
{\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}} |
| 60 |
{\addtocounter{loupe\i}{-1}} |
| 61 |
}{} |
| 62 |
} |
| 63 |
\addtocounter{decalageX}{1} |
| 64 |
\addtocounter{decalageY}{1} |
| 65 |
} |
| 66 |
|
| 67 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 68 |
\begin{document} |
| 69 |
\selectlanguage{english} |
| 70 |
\pagestyle{fancy} |
| 71 |
\fancyhead{} |
| 72 |
\fancyhead[LE,LO]{\em \LaTeX} |
| 73 |
\fancyhead[CE,CO]{\Large \textsc{The \texttt{ScratchX.sty} package}} |
| 74 |
\fancyhead[RE,RO]{\em 2016--2017} |
| 75 |
\fancyfoot[CE,CO]{\thepage /\pageref{LastPage}} |
| 76 |
|
| 77 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 78 |
|
| 79 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 80 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 81 |
\section*{ |
| 82 |
\centering{ |
| 83 |
\begin{Scratch} |
| 84 |
\beginbox{User guide: package \cb[ope]{ScratchX.sty\ }} |
| 85 |
\end{Scratch} |
| 86 |
} |
| 87 |
} |
| 88 |
\begin{center} |
| 89 |
\begin{Scratch} |
| 90 |
\scbox{Thibault Ralet}{ctrl} |
| 91 |
\scbox{March \rb{2017}}{data} |
| 92 |
\end{Scratch} |
| 93 |
\end{center} |
| 94 |
|
| 95 |
\noindent\rule{\linewidth}{.5pt} |
| 96 |
|
| 97 |
|
| 98 |
\parbox{1ex}{\Scratchy[0.1][0.1]}\\ |
| 99 |
|
| 100 |
\hspace{1cm}\parbox{1ex}{\Scratchy[0.2][0.2]}\\ |
| 101 |
|
| 102 |
\hspace{2cm}\parbox{1ex}{\Scratchy[0.5][1]}\\ |
| 103 |
|
| 104 |
\hspace{5cm}\parbox{1ex}{\Scratchy[0.75][1.5]}\\ |
| 105 |
|
| 106 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 107 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 108 |
\section{Introduction} |
| 109 |
The \texttt{ScratchX.sty} package allows you to write any kind of Scratch program in \LaTeX. |
| 110 |
|
| 111 |
The \texttt{ScratchX.sty} package has to be put at least in the same file where the document \texttt{.tex} is created, or in the dedicated place in your computer. |
| 112 |
|
| 113 |
The \texttt{ScratchX.sty} package must be called in the preamble of the document \texttt{.tex} with: |
| 114 |
|
| 115 |
\begin{verbatim} \usepackage{ScratchX} \end{verbatim} |
| 116 |
|
| 117 |
The \texttt{ScratchX.sty} package uses the following packages: |
| 118 |
\begin{verbatim} |
| 119 |
\usepackage[nomessages]{fp} |
| 120 |
\usepackage{calc} |
| 121 |
\usepackage{xstring} |
| 122 |
\usepackage[alpine]{ifsym}%pour avoir VarFlag comme |
| 123 |
%drapeau de départ de Scratch |
| 124 |
\usepackage{ifthen} |
| 125 |
\usepackage{multido} |
| 126 |
\usepackage{xargs} |
| 127 |
\end{verbatim} |
| 128 |
|
| 129 |
In the document \texttt{.tex} that you want to create, you need to load: |
| 130 |
\begin{verbatim} |
| 131 |
\usepackage{tikz} |
| 132 |
\usetikzlibrary{calc} |
| 133 |
\end{verbatim} |
| 134 |
and also: |
| 135 |
\begin{verbatim} |
| 136 |
\usepackage{amssymb} |
| 137 |
\end{verbatim} |
| 138 |
|
| 139 |
You can compile with XeLaTeX or pdfLaTeX. |
| 140 |
|
| 141 |
\newpage |
| 142 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 143 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 144 |
\section{General description} |
| 145 |
|
| 146 |
We write a program (or simply a command) Scratch with the environment: |
| 147 |
|
| 148 |
\begin{verbatim} |
| 149 |
\begin{Scratch} |
| 150 |
%\LaTeX commands in order to create the Scratch commands |
| 151 |
\end{Scratch} |
| 152 |
\end{verbatim} |
| 153 |
|
| 154 |
The command \texttt{\textbackslash begin\{Scratch\}} has the scale in option (1 by default). |
| 155 |
|
| 156 |
Thus,\texttt{\textbackslash begin\{Scratch\}[2]} doubles the program size, whereas \texttt{\textbackslash begin\{Scratch\}[0.7]} reduces by 70\% the size of the created program. |
| 157 |
|
| 158 |
\begin{center} |
| 159 |
\begin{tabular}{cc} |
| 160 |
|
| 161 |
\begin{Scratch}[1] |
| 162 |
\scbox{default size}{app} |
| 163 |
\end{Scratch} |
| 164 |
& |
| 165 |
\begin{Scratch}[2] |
| 166 |
\scbox{bigger}{app} |
| 167 |
\end{Scratch}\\ |
| 168 |
& |
| 169 |
\begin{Scratch}[0.7] |
| 170 |
\scbox{smaller}{app} |
| 171 |
\end{Scratch} |
| 172 |
\end{tabular} |
| 173 |
\end{center} |
| 174 |
|
| 175 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 176 |
\subsection*{The colors} |
| 177 |
The ten specific Scratch colors are defined like this: |
| 178 |
\begin{center} |
| 179 |
\begin{tabular}{c@{:\quad}cp{1cm}c@{:\quad }c}\hline |
| 180 |
mvt&\textcolor{mvt}{Motion}&&evt&\textcolor{evt}{Events}\\ |
| 181 |
app&\textcolor{app}{Looks}&&ctrl&\textcolor{ctrl}{Control}\\ |
| 182 |
son&\textcolor{son}{Sound}&&capt&\textcolor{capt}{Sensing}\\ |
| 183 |
stylo&\textcolor{stylo}{Pen}&&ope&\textcolor{ope}{Operators}\\ |
| 184 |
data&\textcolor{data}{Data}&&bloc&\textcolor{bloc}{More blocks}\\\hline |
| 185 |
\end{tabular} |
| 186 |
\end{center} |
| 187 |
|
| 188 |
\newpage |
| 189 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 190 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 191 |
\section{Command list} |
| 192 |
|
| 193 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 194 |
\subsection{Simples} |
| 195 |
Obtained with \texttt{\textbackslash scbox\{<text>\}\{<color>\}}. |
| 196 |
|
| 197 |
Typing: |
| 198 |
\begin{verbatim} |
| 199 |
\begin{Scratch} |
| 200 |
\scbox{if on edge, bounce}{mvt} |
| 201 |
\scbox{hide}{app} |
| 202 |
\scbox{stop all sounds}{son} |
| 203 |
\scbox{pen down}{stylo} |
| 204 |
\scbox{reset timer}{capt} |
| 205 |
\end{Scratch} |
| 206 |
\end{verbatim} |
| 207 |
|
| 208 |
you get:\\ |
| 209 |
|
| 210 |
\begin{Scratch} |
| 211 |
\scbox{if on edge, bounce}{mvt} |
| 212 |
\scbox{hide}{app} |
| 213 |
\scbox{stop all sounds}{son} |
| 214 |
\scbox{pen down}{stylo} |
| 215 |
\scbox{reset timer}{capt} |
| 216 |
\end{Scratch} |
| 217 |
|
| 218 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 219 |
\subsection{Specials} |
| 220 |
|
| 221 |
\subsubsection{Events}%%%%%%%%%%%%%%%%%%%%%%%% |
| 222 |
Obtained with \texttt{\textbackslash beginbox\{<text>\}}. |
| 223 |
|
| 224 |
\texttt{\textbackslash beginbox\{\}} gives \parbox{1ex}{\begin{Scratch}\beginbox{}\end{Scratch}} |
| 225 |
|
| 226 |
\texttt{\textbackslash beginbox\{clone\}} gives \parbox{1ex}{\begin{Scratch}\beginbox{clone}\end{Scratch}} |
| 227 |
|
| 228 |
\texttt{\textbackslash beginbox\{when this sprite clicked\}} gives |
| 229 |
|
| 230 |
\hfill\parbox{6cm}{\begin{Scratch}\beginbox{when this sprite clicked}\end{Scratch}} |
| 231 |
|
| 232 |
\subsubsection{Turn}%%%%%%%%%%%%%%%%%%%%%%%% |
| 233 |
Obtained with \texttt{\textbackslash turnbox\{<orientation>\}\{<angle>\}}.\\ |
| 234 |
|
| 235 |
\texttt{\textbackslash turnbox\{\}\{-145\}} gives \raisebox{-3mm}{\begin{Scratch}\turnbox{}{-145}\end{Scratch}} |
| 236 |
|
| 237 |
\texttt{\textbackslash turnbox\{gauche\}\{30\}} gives \raisebox{-3mm}{\begin{Scratch}\turnbox{gauche}{30}\end{Scratch}} |
| 238 |
|
| 239 |
You can also write \texttt{\textbackslash turnbox\{g\}\{30\}} or \texttt{\textbackslash turnbox\{G\}\{30\}}. |
| 240 |
|
| 241 |
\subsubsection{Loops}%%%%%%%%%%%%%%%%%%%%%%%% |
| 242 |
Obtained with |
| 243 |
|
| 244 |
\texttt{\textbackslash boucle\{<text>\}\{<number of blocks inside>\}\{<type>\}}, |
| 245 |
|
| 246 |
where <type> is an integer which can be equal to 1 (\emph{repeat $x$ times} or \emph{repeat until}) or -1 (\emph{forever loop}).\\ |
| 247 |
|
| 248 |
\parbox{0.53\linewidth}{\texttt{\textbackslash boucle\{repeat \$x\$ times\}\{2\}\{1\}} |
| 249 |
\par |
| 250 |
\texttt{\textbackslash scbox\{two blocks\}\{red\}} |
| 251 |
\par |
| 252 |
\texttt{\textbackslash scbox\{in the loop\}\{gray\}} |
| 253 |
} |
| 254 |
\parbox{0.12\linewidth}{makes} |
| 255 |
\parbox{0.2\linewidth}{\raisebox{-3mm}{ |
| 256 |
\begin{Scratch}[0.9] |
| 257 |
\boucle{repeat $x$ times}{2}{1} |
| 258 |
\scbox{two blocks}{red} |
| 259 |
\scbox{in the loop}{gray} |
| 260 |
\end{Scratch}}} |
| 261 |
|
| 262 |
\begin{center} |
| 263 |
\begin{tabular}{lcr} |
| 264 |
\texttt{\textbackslash boucle\{forever loop\}\{3\}\{-1\}}&&\multirow{3}{*}{\begin{Scratch}[0.9] |
| 265 |
\boucle{forever loop}{3}{-1} |
| 266 |
\scbox{this time}{pink} |
| 267 |
\scbox{three blocks}{blue} |
| 268 |
\scbox{in the loop}{purple} |
| 269 |
\end{Scratch}}\\ |
| 270 |
\texttt{\textbackslash scbox\{this time\}\{pink\}}&&\\ |
| 271 |
\texttt{\textbackslash scbox\{three blocks\}\{blue\}}&&\\ |
| 272 |
\texttt{\textbackslash scbox\{in the loop\}\{purple\}}&&\\ |
| 273 |
&&\\ |
| 274 |
&&\\ |
| 275 |
\end{tabular}\end{center} |
| 276 |
|
| 277 |
\emph{Notice that if you want to put a loop into another loop, you have to count the correct number of blocks inside the main loop. Actually, a loop counts for two blocks (without the inside blocks).} |
| 278 |
|
| 279 |
\subsubsection{If \dots\ Then}%%%%%%%%%%%%%%%%%%%%%%%% |
| 280 |
|
| 281 |
\emph{Notice that you get this command with the same syntax seen above. Actually:} |
| 282 |
|
| 283 |
\texttt{\textbackslash boucle\{<text>\}\{<number of blocks inside>\}\{2\}}.\\ |
| 284 |
|
| 285 |
\parbox{0.53\linewidth}{\texttt{\textbackslash boucle\{if 4 > 5 then\}\{1\}\{2\}} |
| 286 |
\par |
| 287 |
\texttt{\textbackslash scbox\{problem!\}\{app\}} |
| 288 |
} |
| 289 |
\parbox{0.12\linewidth}{produit} |
| 290 |
\parbox{0.2\linewidth}{\raisebox{-3mm}{ |
| 291 |
\begin{Scratch}[0.9] |
| 292 |
\boucle{if 4 > 5 then}{1}{2} |
| 293 |
\scbox{problem!}{app} |
| 294 |
\end{Scratch}}} |
| 295 |
|
| 296 |
Remark: in order to properly type the \emph{if\dots then} test, see \emph{the small boxes} in section 3.3. |
| 297 |
|
| 298 |
\subsubsection{If \dots\ Then \dots\ Else}%%%%%%%%%%%%%%%%%%%%%%%% |
| 299 |
Obtained with |
| 300 |
|
| 301 |
\texttt{\textbackslash sailors\{<text>\}\{<number of blocks inside>\}} |
| 302 |
|
| 303 |
et |
| 304 |
|
| 305 |
\texttt{\textbackslash simenon\{<number of blocks inside>\}}.\\ |
| 306 |
|
| 307 |
Typing: |
| 308 |
\begin{verbatim} |
| 309 |
\begin{Scratch} |
| 310 |
\sailors{if it's an understandable example}{1} |
| 311 |
\scbox{then it's all right}{app} |
| 312 |
\simenon{2} |
| 313 |
\scbox{don't panick}{stylo} |
| 314 |
\scbox{see the section \emph{Examples}}{capt} |
| 315 |
\end{Scratch} |
| 316 |
\end{verbatim} |
| 317 |
|
| 318 |
you get:\\ |
| 319 |
|
| 320 |
\begin{Scratch} |
| 321 |
\sailors{if it's an understandable example}{1} |
| 322 |
\scbox{then it's all right}{app} |
| 323 |
\simenon{2} |
| 324 |
\scbox{don't panick}{stylo} |
| 325 |
\scbox{see the section \emph{Examples}}{capt} |
| 326 |
\end{Scratch} |
| 327 |
|
| 328 |
\subsubsection{More blocks}%%%%%%%%%%%%%%%%%%%%%%%% |
| 329 |
|
| 330 |
You get them with \texttt{\textbackslash blocbox\{<text>\}}.\\ |
| 331 |
|
| 332 |
\texttt{\textbackslash blocbox\{triangle\}} gives \raisebox{-3mm}{\begin{Scratch}\blocbox{triangle}\end{Scratch}} |
| 333 |
|
| 334 |
\subsubsection{Spécial control}%%%%%%%%%%%%%%%%%%%%%%%% |
| 335 |
It's for \raisebox{-3mm}{\begin{Scratch}\kbox{stop \rb{all}}\end{Scratch}}\hspace{-1cm} and \raisebox{-2mm}{\begin{Scratch}\kbox{delete this clone}\end{Scratch}}\hspace{-1cm}. |
| 336 |
|
| 337 |
These commands are obtained with \texttt{\textbackslash kbox\{<text>\}}. |
| 338 |
|
| 339 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 340 |
\subsection{Inside the Scratch commands: the little boxes} |
| 341 |
How to get some specific commands, like: \raisebox{-3mm}{\begin{Scratch}\kbox{stop \rb{all}}\end{Scratch}}\hspace{-1cm}? |
| 342 |
|
| 343 |
How to type \raisebox{-3mm}{\begin{Scratch}\scbox{wait until \hb[capt]{color \sqb{orange} is touching \sqb{green}?}\ }{ctrl}\end{Scratch}}\hspace{-1cm}? |
| 344 |
|
| 345 |
or \raisebox{-3mm}{\begin{Scratch}\scbox{point towards \rb{mouse-pointer}}{mvt}\end{Scratch}}\hspace{-1cm}? or even |
| 346 |
|
| 347 |
\raisebox{-3mm}{\begin{Scratch} |
| 348 |
\scbox{change volume by \cb[ope]{pick random \cb[w]{1} to \cb[w]{10}} }{son}\end{Scratch}}\hspace{-1cm} ? |
| 349 |
|
| 350 |
\subsubsection{The little rectangular boxes}%%%%%%%%%%%%%%%%%%%%%%%% |
| 351 |
\begin{itemize} |
| 352 |
\item In the \texttt{\textbackslash scbox}: |
| 353 |
|
| 354 |
obtained with |
| 355 |
|
| 356 |
\texttt{\textbackslash rb[<color>]\{<text>\}}\\ |
| 357 |
|
| 358 |
\item dans les \texttt{\textbackslash beginbox} : |
| 359 |
|
| 360 |
you get them with |
| 361 |
|
| 362 |
\texttt{\textbackslash rbb[<color>]\{<text>\}}\\ |
| 363 |
\end{itemize} |
| 364 |
|
| 365 |
In both cases, <color> has by default the color of the box it is inside. In order to get a white rectangular box, you just have to put <color> at white or w.\\ |
| 366 |
|
| 367 |
Typing: |
| 368 |
\begin{verbatim} |
| 369 |
\begin{Scratch} |
| 370 |
\scbox{play sound \rb{meow}}{son} |
| 371 |
\scbox{think \rb[white]{Hmm\dots}}{app} |
| 372 |
\scbox{ask \rb[w]{What's your name?} and wait}{capt} |
| 373 |
\end{Scratch} |
| 374 |
\end{verbatim} |
| 375 |
|
| 376 |
you get:\\ |
| 377 |
|
| 378 |
\begin{Scratch} |
| 379 |
\scbox{play sound \rb{meow}}{son} |
| 380 |
\scbox{think \rb[white]{Hmm\dots}}{app} |
| 381 |
\scbox{ask \rb[w]{What's your name?} and wait}{capt} |
| 382 |
\end{Scratch} |
| 383 |
|
| 384 |
\subsubsection{The small round boxes}%%%%%%%%%%%%%%%%%%%%%%%% |
| 385 |
|
| 386 |
They are hollowed or embossed. |
| 387 |
|
| 388 |
You get them with |
| 389 |
|
| 390 |
\texttt{\textbackslash cb[<color>]\{<text>\}}\\ |
| 391 |
|
| 392 |
By default, <color> has the same color of the circular box it is inside. If <color> is white or w, the circular box is hollowed.\\ |
| 393 |
|
| 394 |
Typing: |
| 395 |
\begin{verbatim} |
| 396 |
\begin{Scratch} |
| 397 |
\scbox{set video transparency to \cb{answer} \%}{capt} |
| 398 |
\scbox{go to x:\cb[w]{x} y:\cb[white]{y}}{mvt} |
| 399 |
\scbox{change tempo by \cb[data]{variable} }{son} |
| 400 |
\end{Scratch} |
| 401 |
\end{verbatim} |
| 402 |
|
| 403 |
you get:\\ |
| 404 |
|
| 405 |
\begin{Scratch} |
| 406 |
\scbox{set video transparency to \cb{answer} \%}{capt} |
| 407 |
\scbox{go to x:\cb[w]{x} y:\cb[white]{y}}{mvt} |
| 408 |
\scbox{change tempo by \cb[data]{variable} }{son} |
| 409 |
\end{Scratch} |
| 410 |
|
| 411 |
|
| 412 |
\subsubsection{The small hexagonal boxes}%%%%%%%%%%%%%%%%%%%%%%%% |
| 413 |
Only for \emph{Sensing} et \emph{Operators} commands. |
| 414 |
|
| 415 |
You get them with |
| 416 |
|
| 417 |
\texttt{\textbackslash hb[<color>]\{<text>\}}\\ |
| 418 |
|
| 419 |
By default, <color> is ope. |
| 420 |
|
| 421 |
Typing: |
| 422 |
\begin{verbatim} |
| 423 |
\begin{Scratch} |
| 424 |
\boucle{if \hb{\cb[data]{variable}=\rb[w]{10}} then}{1}{1} |
| 425 |
\scbox{wait until \hb[capt]{mouse down?}}{ctrl} |
| 426 |
\end{Scratch} |
| 427 |
\end{verbatim} |
| 428 |
|
| 429 |
you get:\\ |
| 430 |
|
| 431 |
\begin{Scratch} |
| 432 |
\boucle{if \hb{\cb[data]{variable}=\rb[w]{10}} then}{1}{1} |
| 433 |
\scbox{wait until \hb[capt]{mouse down?}}{ctrl} |
| 434 |
\end{Scratch} |
| 435 |
|
| 436 |
|
| 437 |
\subsubsection{The small squared boxes}%%%%%%%%%%%%%%%%%%%%%%%% |
| 438 |
Only for the colored squares. |
| 439 |
|
| 440 |
You get them with |
| 441 |
|
| 442 |
\texttt{\textbackslash sqb\{<color>\}}\\ |
| 443 |
|
| 444 |
Typing: |
| 445 |
\begin{verbatim} |
| 446 |
\begin{Scratch} |
| 447 |
\scbox{set pen color to \sqb{brown}}{stylo} |
| 448 |
\end{Scratch} |
| 449 |
\end{verbatim} |
| 450 |
|
| 451 |
you get: \raisebox{-3mm}{\begin{Scratch} |
| 452 |
\scbox{set pen color to \sqb{brown}}{stylo} |
| 453 |
\end{Scratch}} |
| 454 |
|
| 455 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 456 |
\subsection{Intricate commands} |
| 457 |
|
| 458 |
\begin{Scratch}%%%%%%%%%%%%%%%%%%%%%%%% 1 |
| 459 |
\beginbox{clone} |
| 460 |
\boucle{repeat until \hb[capt]{color \sqb{black} |
| 461 |
is touching \sqb{yellow} ? }}{1}{1} |
| 462 |
\scbox{go to x: \cb[ope]{\cb[data]{x}+\cb[w]{10}} y: \cb[data]{y}}{mvt} |
| 463 |
\boucle{if \hb{\cb[data]{y}<\cb[capt]{answer}} then}{3}{1} |
| 464 |
\scbox{set \rb{y} to \cb[son]{volume}}{data} |
| 465 |
\scbox{say \rb[w]{Hello!} for \cb[capt]{distance to |
| 466 |
\rb{mouse-pointer} } secs}{app} |
| 467 |
\kbox{stop \rb{all}} |
| 468 |
\turnbox{2}{-146} |
| 469 |
\end{Scratch} |
| 470 |
|
| 471 |
Got with: |
| 472 |
|
| 473 |
\begin{verbatim} |
| 474 |
\begin{Scratch} |
| 475 |
\beginbox{clone} |
| 476 |
\boucle{repeat until \hb[capt]{color \sqb{black} |
| 477 |
is touching \sqb{yellow} ? }}{1}{1} |
| 478 |
\scbox{go to x: \cb[ope]{\cb[data]{x}+\cb[w]{10}} y: \cb[data]{y}}{mvt} |
| 479 |
\boucle{if \hb{\cb[data]{y}<\cb[capt]{answer}} then}{3}{1} |
| 480 |
\scbox{set \rb{y} to \cb[son]{volume}}{data} |
| 481 |
\scbox{say \rb[w]{Hello!} for \cb[capt]{distance to |
| 482 |
\rb{mouse-pointer} } secs}{app} |
| 483 |
\kbox{stop \rb{all}} |
| 484 |
\turnbox{2}{-146} |
| 485 |
\end{Scratch} |
| 486 |
\end{verbatim} |
| 487 |
|
| 488 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 489 |
\subsection{Other sort of commands} |
| 490 |
|
| 491 |
\subsubsection{In the loops}%%%%%%%%%%%%%%%%%%%%%% |
| 492 |
|
| 493 |
You need to use the command \texttt{\textbackslash blank} when in the Scratch program, two loops ends at the same time.\\ |
| 494 |
|
| 495 |
Typing: |
| 496 |
\begin{verbatim} |
| 497 |
\begin{Scratch} |
| 498 |
\boucle{repeat \cb[w]{3}}{4}{1} |
| 499 |
\scbox{move \cb[w]{10} steps}{mvt} |
| 500 |
\boucle{repeat \cb[w]{5}}{1}{1} |
| 501 |
\scbox{change x by \cb[w]{10}}{mvt} |
| 502 |
\scbox{this block is not ok}{data} |
| 503 |
\end{Scratch} |
| 504 |
\end{verbatim} |
| 505 |
|
| 506 |
you get:\\ |
| 507 |
|
| 508 |
\begin{Scratch} |
| 509 |
\boucle{repeat \cb[w]{3}}{4}{1} |
| 510 |
\scbox{move \cb[w]{10} steps}{mvt} |
| 511 |
\boucle{repeat \cb[w]{5}}{1}{1} |
| 512 |
\scbox{change x by \cb[w]{10}}{mvt} |
| 513 |
\scbox{this block is not ok}{data} |
| 514 |
\end{Scratch} |
| 515 |
|
| 516 |
\vspace{0.5cm} |
| 517 |
|
| 518 |
Whereas typing: |
| 519 |
\begin{verbatim} |
| 520 |
\begin{Scratch} |
| 521 |
\boucle{repeat \cb[w]{3}}{4}{1} |
| 522 |
\scbox{move \cb[w]{10} steps}{mvt} |
| 523 |
\boucle{repeat \cb[w]{5}}{1}{1} |
| 524 |
\scbox{change x by \cb[w]{10}}{mvt} |
| 525 |
\blank |
| 526 |
\scbox{this block is \emph{now} ok}{data} |
| 527 |
\end{Scratch} |
| 528 |
\end{verbatim} |
| 529 |
|
| 530 |
you get:\\ |
| 531 |
|
| 532 |
\begin{Scratch} |
| 533 |
\boucle{repeat \cb[w]{3}}{4}{1} |
| 534 |
\scbox{move \cb[w]{10} steps}{mvt} |
| 535 |
\boucle{repeat \cb[w]{5}}{1}{1} |
| 536 |
\scbox{change x by \cb[w]{10}}{mvt} |
| 537 |
\blank |
| 538 |
\scbox{this block is \emph{now} ok}{data} |
| 539 |
\end{Scratch} |
| 540 |
|
| 541 |
\vspace{0.5cm} |
| 542 |
|
| 543 |
If you type: |
| 544 |
\begin{verbatim} |
| 545 |
\begin{Scratch} |
| 546 |
\boucle{repeat \cb[w]{3}}{5}{1} |
| 547 |
\scbox{move \cb[w]{10} steps}{mvt} |
| 548 |
\boucle{repeat \cb[w]{5}}{1}{1} |
| 549 |
\scbox{change x by \cb[w]{10}}{mvt} |
| 550 |
\scbox{this block is in another position}{data} |
| 551 |
\end{Scratch} |
| 552 |
\end{verbatim} |
| 553 |
|
| 554 |
you get:\\ |
| 555 |
|
| 556 |
\begin{Scratch} |
| 557 |
\boucle{repeat \cb[w]{3}}{5}{1} |
| 558 |
\scbox{move \cb[w]{10} steps}{mvt} |
| 559 |
\boucle{repeat \cb[w]{5}}{1}{1} |
| 560 |
\scbox{change x by \cb[w]{10}}{mvt} |
| 561 |
\scbox{this block is in another position}{data} |
| 562 |
\end{Scratch} |
| 563 |
|
| 564 |
\subsubsection{How to draw the cat} |
| 565 |
|
| 566 |
You can get the cover cat with: |
| 567 |
|
| 568 |
\texttt{\small\textbackslash Scratchy[<scale>][<lines width>]} |
| 569 |
|
| 570 |
By default, the scale is 0.25 and the lines width is set at 0.25 pt.\\ |
| 571 |
|
| 572 |
Here is the code for the cover: |
| 573 |
\begin{verbatim} |
| 574 |
\parbox{1ex}{\Scratchy[0.1][0.1]}\\ |
| 575 |
|
| 576 |
\hspace{1cm}\parbox{1ex}{\Scratchy[0.2][0.2]}\\ |
| 577 |
|
| 578 |
\hspace{2cm}\parbox{1ex}{\Scratchy[0.5][1]}\\ |
| 579 |
|
| 580 |
\hspace{5cm}\parbox{1ex}{\Scratchy[0.75][1.5]}\\ |
| 581 |
\end{verbatim} |
| 582 |
|
| 583 |
\newpage |
| 584 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 585 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 586 |
\section{Known problems and solutions} |
| 587 |
\begin{enumerate} |
| 588 |
\item |
| 589 |
The black little triangle doesn't exist in the command \emph{point in direction} (motion). You have to write it down. |
| 590 |
\begin{verbatim} |
| 591 |
\scbox{point in direction \cb[w]{90 \scriptsize$\blacktriangledown$}}{mvt} |
| 592 |
\end{verbatim} |
| 593 |
\raisebox{-3mm}{\begin{Scratch}\scbox{point in direction \cb[w]{90 \scriptsize$\blacktriangledown$}}{mvt}\end{Scratch}}\\ |
| 594 |
|
| 595 |
\item The height of the boxes is set. Therefor, you cannot put a lot of under-commands in a Scratch command.\\ |
| 596 |
|
| 597 |
\item When you need to put only one Scratch command into some text, it is not vertically centered. You can use a: \texttt{\textbackslash raisebox\{-3mm\}}.\\ |
| 598 |
|
| 599 |
\item There is also a tiny horizontal gap. When a Scratch environment is over, you often need to add a \texttt{\textbackslash hspace\{-1cm\}}.\\ |
| 600 |
|
| 601 |
\item The compile time is sometimes long! |
| 602 |
\end{enumerate} |
| 603 |
|
| 604 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 605 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 606 |
\section{Commands summary} |
| 607 |
|
| 608 |
\begin{tabular}{m{5cm}l}%%%%%%%%%% |
| 609 |
\texttt{\small\textbackslash beginbox\{\}} |
| 610 |
|
| 611 |
&\begin{Scratch}[0.75] |
| 612 |
\beginbox{} |
| 613 |
\end{Scratch} |
| 614 |
\\%%%%%%%%%% |
| 615 |
\texttt{\small\textbackslash beginbox\{<text>\}} |
| 616 |
|
| 617 |
\tiny(when this sprite clicked) |
| 618 |
&\begin{Scratch}[0.75] |
| 619 |
\beginbox{quand ce lutin est cliqué} |
| 620 |
\end{Scratch}\\%%%%%%%%%% |
| 621 |
\texttt{\small\textbackslash beginbox\{clone\}} |
| 622 |
|
| 623 |
&\begin{Scratch}[0.75] |
| 624 |
\beginbox{clone} |
| 625 |
\end{Scratch} |
| 626 |
\\%%%%%%%%%% |
| 627 |
\texttt{\small\textbackslash blocbox\{<text>\}} |
| 628 |
|
| 629 |
&\begin{Scratch}[0.75] |
| 630 |
\blocbox{function} |
| 631 |
\end{Scratch} |
| 632 |
\\%%%%%%%%%% |
| 633 |
\texttt{\small\textbackslash turnbox\{\}\{90\}} |
| 634 |
|
| 635 |
&\begin{Scratch}[0.75] |
| 636 |
\turnbox{}{90} |
| 637 |
\end{Scratch}\\%%%%%%%%%% |
| 638 |
\texttt{\small\textbackslash turnbox\{g\}\{-270\}} |
| 639 |
|
| 640 |
\tiny(or <gauche> or <G> or <g>) |
| 641 |
&\begin{Scratch}[0.75] |
| 642 |
\turnbox{g}{-270} |
| 643 |
\end{Scratch} |
| 644 |
\\%%%%%%%%%% |
| 645 |
\texttt{\small\textbackslash scbox\{<text>\}\{<color>\}} |
| 646 |
|
| 647 |
&\begin{Scratch}[0.75] |
| 648 |
\scbox{any color, any text}{purple} |
| 649 |
\end{Scratch}\\%%%%%%%%%% |
| 650 |
\texttt{\small\textbackslash boucle\{repeat\}\{2\}\{1\}} |
| 651 |
\tiny(\{<text>\}\{<nbr blocks>\}\{<type>\}) |
| 652 |
\vspace{3cm} |
| 653 |
&\begin{Scratch}[0.75] |
| 654 |
\boucle{repeat}{2}{1} |
| 655 |
\end{Scratch}\vspace{-1.5cm} |
| 656 |
\\%%%%%%%%%% |
| 657 |
\texttt{\small\textbackslash boucle\{forever\}\{1\}\{-1\}} |
| 658 |
|
| 659 |
\tiny(\{<text>\}\{<nbr blocks>\}\{<type>\}) |
| 660 |
\vspace{2cm} |
| 661 |
&\begin{Scratch}[0.75] |
| 662 |
\boucle{forever}{1}{-1} |
| 663 |
\end{Scratch}\vspace{-1.2cm} |
| 664 |
\\%%%%%%%%%% |
| 665 |
\texttt{\small\textbackslash boucle\{if \dots then\}\{1\}\{2\}} |
| 666 |
|
| 667 |
\tiny(\{<text>\}\{<nbr blocks>\}\{<type>\}) |
| 668 |
\vspace{2cm} |
| 669 |
&\begin{Scratch}[0.75] |
| 670 |
\boucle{if \dots then}{1}{2} |
| 671 |
\end{Scratch}\vspace{-1.2cm} |
| 672 |
\\%%%%%%%%%% |
| 673 |
|
| 674 |
\texttt{\small\textbackslash sailors\{if\dots then\dots\}\{2\}} |
| 675 |
|
| 676 |
\tiny(\{<text>\}\{<nbr blocks>\}) |
| 677 |
\vspace{2cm} |
| 678 |
&\begin{Scratch}[0.75] |
| 679 |
\sailors{fi\dots then\dots}{2} |
| 680 |
\end{Scratch}\vspace{-1cm} |
| 681 |
\\%%%%%%%%%% |
| 682 |
\texttt{\small\textbackslash simenon\{<nbre blocks>\}} |
| 683 |
|
| 684 |
\tiny(ici, \textbackslash simenon\{1\}) |
| 685 |
\vspace{2.2cm} |
| 686 |
&\begin{Scratch}[0.75] |
| 687 |
\whitesailors{il faut que ce }{1} |
| 688 |
\simenon{1} |
| 689 |
\end{Scratch}\vspace{-1.2cm} |
| 690 |
\\%%%%%%%%%% |
| 691 |
\texttt{\small\textbackslash kbox\{<text>\}} |
| 692 |
|
| 693 |
&\begin{Scratch}[0.75] |
| 694 |
\kbox{delete this clone} |
| 695 |
\end{Scratch} |
| 696 |
\\%%%%%%%%%% |
| 697 |
\end{tabular} |
| 698 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 699 |
|
| 700 |
\begin{tabular}{m{5cm}l} |
| 701 |
\texttt{\small\textbackslash rb\{<text>\}} |
| 702 |
|
| 703 |
\tiny (\texttt{\textbackslash rb\{variable\}}) |
| 704 |
&\begin{Scratch}[0.75] |
| 705 |
\scbox{\phantom{tex} \rb{variable} \phantom{tex}}{data} |
| 706 |
\end{Scratch} |
| 707 |
\\ |
| 708 |
\texttt{\small\textbackslash rb[w]\{<text>\}} |
| 709 |
|
| 710 |
\tiny(ou \texttt{\textbackslash rb[white]\{<text>\}}) |
| 711 |
&\begin{Scratch}[0.75] |
| 712 |
\scbox{\phantom{tex} \rb[w]{text} }{data} |
| 713 |
\end{Scratch} |
| 714 |
\\ |
| 715 |
\texttt{\small\textbackslash rbb\{<text>\}} |
| 716 |
|
| 717 |
\tiny(only for \texttt{\textbackslash beginbox}) |
| 718 |
|
| 719 |
\texttt{\textbackslash beginbox\{when I receive \textbackslash rbb\{message1\}\}} |
| 720 |
&\begin{Scratch}[0.75] |
| 721 |
\beginbox{when I receive \rbb{message1}} |
| 722 |
\end{Scratch} |
| 723 |
\\ |
| 724 |
|
| 725 |
\texttt{\small\textbackslash cb\{<text>\}} |
| 726 |
|
| 727 |
\tiny(transparent) |
| 728 |
&\begin{Scratch}[0.75] |
| 729 |
\scbox{\phantom{rex} \cb{answer}}{ctrl} |
| 730 |
\end{Scratch} |
| 731 |
\\ |
| 732 |
\texttt{\small\textbackslash cb[w]\{<text>\}} |
| 733 |
|
| 734 |
\tiny(ou \textbackslash cb[white]\{<text>\}) |
| 735 |
&\begin{Scratch}[0.75] |
| 736 |
\scbox{\phantom{rex} \cb[w]{answer}}{ctrl} |
| 737 |
\end{Scratch} |
| 738 |
\\ |
| 739 |
\texttt{\small\textbackslash cb[<color>]\{<text>\}} |
| 740 |
|
| 741 |
\texttt{\tiny\textbackslash cb[ope]\{answer\}} |
| 742 |
&\begin{Scratch}[0.75] |
| 743 |
\scbox{\phantom{rex} \cb[ope]{answer}}{ctrl} |
| 744 |
\end{Scratch} |
| 745 |
\\ |
| 746 |
\texttt{\small\textbackslash hb\{<text>\}} |
| 747 |
|
| 748 |
&\begin{Scratch}[0.75] |
| 749 |
\scbox{\phantom{rex} \hb{answer}}{ctrl} |
| 750 |
\end{Scratch} |
| 751 |
\\ |
| 752 |
|
| 753 |
\texttt{\small\textbackslash hb[capt]\{<text>\}} |
| 754 |
|
| 755 |
&\begin{Scratch}[0.75] |
| 756 |
\scbox{\phantom{rex} \hb[capt]{answer}}{ctrl} |
| 757 |
\end{Scratch} |
| 758 |
\\ |
| 759 |
\texttt{\small\textbackslash sqb\{<color>\}} |
| 760 |
|
| 761 |
&\begin{Scratch}[0.75] |
| 762 |
\scbox{set pen color to \sqb{red}}{stylo} |
| 763 |
\end{Scratch} |
| 764 |
\\ |
| 765 |
|
| 766 |
\end{tabular} |
| 767 |
|
| 768 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 769 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 770 |
\newpage |
| 771 |
\section{Examples of programs (in French):} |
| 772 |
|
| 773 |
\begin{verbatim} |
| 774 |
\begin{Scratch} |
| 775 |
\boucle{répéter \cb[w]{3} fois}{5}{1} |
| 776 |
\scbox{avancer de \cb[w]{10}}{mvt} |
| 777 |
\boucle{répéter \cb[w]{5} fois}{1}{1} |
| 778 |
\scbox{ajouter \cb[w]{10} à x}{mvt} |
| 779 |
\scbox{ce bloc est placé autrement}{data} |
| 780 |
\scbox{un nouveau bloc}{son} |
| 781 |
\end{Scratch} |
| 782 |
\end{verbatim} |
| 783 |
|
| 784 |
\begin{verbatim} |
| 785 |
\begin{Scratch} |
| 786 |
\beginbox{quand \rbb{espace} est pressé} |
| 787 |
\boucle{répéter \cb[w]{3} fois}{8}{1} |
| 788 |
\scbox{aller à x: \cb[w]{0} y: \cb[data]{y}}{mvt} |
| 789 |
\boucle{répéter \cb[w]{2} fois}{3}{1} |
| 790 |
\scbox{mettre \rb{x} à \rb[w]{0}}{data} |
| 791 |
\scbox{ajouter à \rb{y} \cb[w]{10}}{data} |
| 792 |
\scbox{mettre la couleur du stylo à \sqb{red}}{stylo} |
| 793 |
\scbox{mon bloc}{bloc} |
| 794 |
\scbox{montrer}{app} |
| 795 |
\scbox{effacer tout}{stylo} |
| 796 |
\end{Scratch} |
| 797 |
\end{verbatim} |
| 798 |
\begin{center} |
| 799 |
\begin{tabular}{cc}%\hline |
| 800 |
\parbox[b]{5.5cm}{ |
| 801 |
\hspace{1cm}deuxième programme $\rightarrow$ |
| 802 |
\vspace{2em} |
| 803 |
\par |
| 804 |
premier programme |
| 805 |
\par |
| 806 |
\hspace{1.25em}$\downarrow$ |
| 807 |
\par |
| 808 |
\begin{Scratch} |
| 809 |
\boucle{répéter \cb[w]{3} fois}{5}{1} |
| 810 |
\scbox{avancer de \cb[w]{10}}{mvt} |
| 811 |
\boucle{répéter \cb[w]{5} fois}{1}{1} |
| 812 |
\scbox{ajouter \cb[w]{10} à x}{mvt} |
| 813 |
\scbox{ce bloc est placé \dots}{data} |
| 814 |
\scbox{un nouveau bloc}{son} |
| 815 |
\end{Scratch} |
| 816 |
} |
| 817 |
& |
| 818 |
\begin{Scratch} |
| 819 |
\beginbox{quand \rbb{espace} est pressé} |
| 820 |
\boucle{répéter \cb[w]{3} fois}{8}{1} |
| 821 |
\scbox{aller à x: \cb[w]{0} y: \cb[data]{y}}{mvt} |
| 822 |
\boucle{répéter \cb[w]{2} fois}{3}{1} |
| 823 |
\scbox{mettre \rb{x} à \rb[w]{0}}{data} |
| 824 |
\scbox{ajouter à \rb{y} \cb[w]{10}}{data} |
| 825 |
\scbox{mettre la couleur du stylo à \sqb{red}}{stylo} |
| 826 |
\scbox{mon bloc}{bloc} |
| 827 |
\scbox{montrer}{app} |
| 828 |
\scbox{effacer tout}{stylo} |
| 829 |
\end{Scratch} |
| 830 |
\end{tabular} |
| 831 |
\end{center} |
| 832 |
\newpage |
| 833 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 834 |
\subsection{Loops of loops} |
| 835 |
|
| 836 |
%%%%%%%%%%%%%%%%%%%%%%%% 1 |
| 837 |
\begin{verbatim} |
| 838 |
\begin{Scratch} |
| 839 |
\beginbox{quand \rb{chronomètre} > \cb[w]{10}} |
| 840 |
|
| 841 |
\sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{12} |
| 842 |
|
| 843 |
\sailors{si \hb[capt]{souris pressée?} alors}{1} |
| 844 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 845 |
|
| 846 |
\simenon{2} |
| 847 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 848 |
\scbox{ajouter \cb[w]{10} à y}{mvt} |
| 849 |
|
| 850 |
\sailors{si couleur \sqb{son} touchée?}{1} |
| 851 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 852 |
|
| 853 |
\simenon{1} |
| 854 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 855 |
|
| 856 |
\simenon{1} |
| 857 |
\scbox{donner la valeur \cb[w]{0} à y}{mvt} |
| 858 |
|
| 859 |
\sailors{si \hb[capt]{souris pressée?} alors}{1} |
| 860 |
\scbox{ajouter \cb[w]{10} à y}{mvt} |
| 861 |
|
| 862 |
\simenon{2} |
| 863 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 864 |
\scbox{cacher la variable \rb{variable}}{data} |
| 865 |
|
| 866 |
\end{Scratch} |
| 867 |
\end{verbatim} |
| 868 |
|
| 869 |
\begin{center} |
| 870 |
\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 1 |
| 871 |
\beginbox{quand \rb{chronomètre} > \cb[w]{10}} |
| 872 |
|
| 873 |
\sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{12} |
| 874 |
|
| 875 |
\sailors{si \hb[capt]{souris pressée?} alors}{1} |
| 876 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 877 |
|
| 878 |
\simenon{2} |
| 879 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 880 |
\scbox{ajouter \cb[w]{10} à y}{mvt} |
| 881 |
|
| 882 |
\sailors{si couleur \sqb{son} touchée?}{1} |
| 883 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 884 |
|
| 885 |
\simenon{1} |
| 886 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 887 |
|
| 888 |
\simenon{1} |
| 889 |
\scbox{donner la valeur \cb[w]{0} à y}{mvt} |
| 890 |
|
| 891 |
\sailors{si \hb[capt]{souris pressée?} alors}{1} |
| 892 |
\scbox{ajouter \cb[w]{10} à y}{mvt} |
| 893 |
|
| 894 |
\simenon{2} |
| 895 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 896 |
\scbox{cacher la variable \rb{variable}}{data} |
| 897 |
|
| 898 |
\end{Scratch}\end{center} |
| 899 |
\newpage |
| 900 |
%%%%%%%%%%%%%%%%%%%%%%%% 2 |
| 901 |
\begin{verbatim} |
| 902 |
\begin{Scratch} |
| 903 |
\beginbox{} |
| 904 |
|
| 905 |
\sailors{si couleur \sqb{stylo} touchée?}{12} |
| 906 |
|
| 907 |
\sailors{si \hb[capt]{souris pressée?} alors}{6} |
| 908 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 909 |
|
| 910 |
\sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{1} |
| 911 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 912 |
|
| 913 |
\simenon{1} |
| 914 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 915 |
|
| 916 |
\simenon{2} |
| 917 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 918 |
\scbox{ajouter \cb[w]{10} à y}{mvt} |
| 919 |
|
| 920 |
\simenon{1} |
| 921 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 922 |
|
| 923 |
\end{Scratch} |
| 924 |
\end{verbatim} |
| 925 |
\begin{center} |
| 926 |
\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 2 |
| 927 |
\beginbox{} |
| 928 |
|
| 929 |
\sailors{si couleur \sqb{stylo} touchée?}{12} |
| 930 |
|
| 931 |
\sailors{si \hb[capt]{souris pressée?} alors}{6} |
| 932 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 933 |
|
| 934 |
\sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{1} |
| 935 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 936 |
|
| 937 |
\simenon{1} |
| 938 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 939 |
|
| 940 |
\simenon{2} |
| 941 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 942 |
\scbox{ajouter \cb[w]{10} à y}{mvt} |
| 943 |
|
| 944 |
\simenon{1} |
| 945 |
\scbox{donner la valeur \cb[w]{0} à x}{mvt} |
| 946 |
|
| 947 |
\end{Scratch}\end{center} |
| 948 |
|
| 949 |
\newpage |
| 950 |
%%%%%%%%%%%%%%%%%%%%%%%% 3 |
| 951 |
\begin{verbatim} |
| 952 |
\begin{Scratch} |
| 953 |
\beginbox{} |
| 954 |
\boucle{répéter indéfiniment}{13}{-1} |
| 955 |
\turnbox{}{24} |
| 956 |
\boucle{répéter \cb[w]{4} fois}{2}{1} |
| 957 |
\scbox{stylo en position d'écriture}{stylo} |
| 958 |
\scbox{ajouter \cb[w]{20} au tempo}{son} |
| 959 |
\boucle{quand le lutin s'en va}{6}{1} |
| 960 |
\scbox{cacher la variable \rb{A}}{data} |
| 961 |
\scbox{costume suivant}{app} |
| 962 |
\scbox{arrêter tous les sons}{son} |
| 963 |
\turnbox{g}{24} |
| 964 |
\scbox{stylo en position d'écriture}{stylo} |
| 965 |
\scbox{ajouter \cb[w]{20} au tempo}{son} |
| 966 |
\blank |
| 967 |
\end{Scratch} |
| 968 |
\end{verbatim} |
| 969 |
\begin{center} |
| 970 |
\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 3 |
| 971 |
\beginbox{} |
| 972 |
\boucle{répéter indéfiniment}{13}{-1} |
| 973 |
\turnbox{}{24} |
| 974 |
\boucle{répéter \cb[w]{4} fois}{2}{1} |
| 975 |
\scbox{stylo en position d'écriture}{stylo} |
| 976 |
\scbox{ajouter \cb[w]{20} au tempo}{son} |
| 977 |
\boucle{répéter \cb[w]{4} fois}{6}{1} |
| 978 |
\scbox{cacher la variable \rb{A}}{data} |
| 979 |
\scbox{costume suivant}{app} |
| 980 |
\scbox{arrêter tous les sons}{son} |
| 981 |
\turnbox{g}{24} |
| 982 |
\scbox{stylo en position d'écriture}{stylo} |
| 983 |
\scbox{ajouter \cb[w]{20} au tempo}{son} |
| 984 |
\blank |
| 985 |
\end{Scratch} |
| 986 |
\end{center} |
| 987 |
\newpage |
| 988 |
%%%%%%%%%%%%%%%%%%%%%%%% 4 |
| 989 |
\begin{verbatim} |
| 990 |
\begin{Scratch} |
| 991 |
\beginbox{quand on le veut} |
| 992 |
\boucle{répéter un certain nombre de fois}{8}{1} |
| 993 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 994 |
\boucle{le dernier ??}{2}{1} |
| 995 |
\scbox{on peut faire}{gray} |
| 996 |
\scbox{ce que l'on veut}{black} |
| 997 |
\boucle{ne pas répéter}{1}{1} |
| 998 |
\scbox{faux bloc}{brown} |
| 999 |
\blank |
| 1000 |
\scbox{dernier bloc}{pink} |
| 1001 |
\end{Scratch} |
| 1002 |
\end{verbatim} |
| 1003 |
|
| 1004 |
\begin{center} |
| 1005 |
\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 4 |
| 1006 |
\beginbox{quand on le veut} |
| 1007 |
\boucle{répéter un certain nombre de fois}{8}{1} |
| 1008 |
\scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} |
| 1009 |
\boucle{se répéter que}{2}{1} |
| 1010 |
\scbox{l'on peut faire}{gray} |
| 1011 |
\scbox{ce que l'on veut}{black} |
| 1012 |
\boucle{ne pas répéter}{1}{1} |
| 1013 |
\scbox{faux bloc}{brown} |
| 1014 |
\blank |
| 1015 |
\scbox{dernier bloc}{pink} |
| 1016 |
\end{Scratch} |
| 1017 |
\end{center} |
| 1018 |
\newpage |
| 1019 |
%%%%%%%%%%%%%%%%%%%%%%%% 5 |
| 1020 |
\begin{verbatim} |
| 1021 |
\begin{Scratch} |
| 1022 |
\beginbox{} |
| 1023 |
\boucle{répéter \cb[w]{3} fois}{19}{1} |
| 1024 |
\scbox{costume suivant}{app} |
| 1025 |
\scbox{arrêter tous les sons}{son} |
| 1026 |
\turnbox{1}{24} |
| 1027 |
\scbox{stylo en position d'écriture}{stylo} |
| 1028 |
\boucle{répéter \cb[data]{compteur} fois}{10}{1} |
| 1029 |
\scbox{ajouter \cb[w]{20} au tempo}{son} |
| 1030 |
\boucle{répéter \cb[ope]{\cb[data]{A}+1} fois}{6}{1} |
| 1031 |
\scbox{réinitialiser le chronomètre}{capt} |
| 1032 |
\boucle{répéter jusqu'à \hb[capt]{\rb{pointeur de souris} touché?}}{2}{1} |
| 1033 |
\scbox{cacher la variable \rb{A}}{data} |
| 1034 |
\scbox{avancer de 35}{mvt} |
| 1035 |
\scbox{regroupe \rb[w]{hello}\rb[w]{world}}{ope} |
| 1036 |
\scbox{nouveau bloc}{bloc} |
| 1037 |
\turnbox{2}{-146} |
| 1038 |
\scbox{estampiller}{stylo} |
| 1039 |
\scbox{annuler les effets graphiques}{app} |
| 1040 |
\sailors{si ça marche}{1} |
| 1041 |
\scbox{je suis content}{stylo} |
| 1042 |
\simenon{1} |
| 1043 |
\scbox{je suis déçu}{app} |
| 1044 |
\end{Scratch} |
| 1045 |
\end{verbatim} |
| 1046 |
|
| 1047 |
\begin{center} |
| 1048 |
\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 5 |
| 1049 |
\beginbox{} |
| 1050 |
\boucle{répéter \cb[w]{3} fois}{19}{1} |
| 1051 |
\scbox{costume suivant}{app} |
| 1052 |
\scbox{arrêter tous les sons}{son} |
| 1053 |
\turnbox{1}{24} |
| 1054 |
\scbox{stylo en position d'écriture}{stylo} |
| 1055 |
\boucle{répéter \cb[data]{compteur} fois}{10}{1} |
| 1056 |
\scbox{ajouter \cb[w]{20} au tempo}{son} |
| 1057 |
\boucle{répéter \cb[ope]{\cb[data]{A}+1} fois}{6}{1} |
| 1058 |
\scbox{réinitialiser le chronomètre}{capt} |
| 1059 |
\boucle{répéter jusqu'à \hb[capt]{\rb{pointeur de souris} touché?}}{2}{1} |
| 1060 |
\scbox{cacher la variable \rb{A}}{data} |
| 1061 |
\scbox{avancer de 35}{mvt} |
| 1062 |
\scbox{regroupe \rb[w]{hello}\rb[w]{world}}{ope} |
| 1063 |
\scbox{nouveau bloc}{bloc} |
| 1064 |
\turnbox{2}{-146} |
| 1065 |
\scbox{estampiller}{stylo} |
| 1066 |
\scbox{annuler les effets gRaphiques}{app} |
| 1067 |
\sailors{si ça marche}{1} |
| 1068 |
\scbox{je suis content}{stylo} |
| 1069 |
\simenon{1} |
| 1070 |
\scbox{je suis déçu}{app} |
| 1071 |
\end{Scratch} |
| 1072 |
\end{center} |
| 1073 |
|
| 1074 |
\newpage |
| 1075 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 1076 |
%----------------------------------------------------------------------------------------------------------------------------------% |
| 1077 |
\section{Conclusion} |
| 1078 |
|
| 1079 |
Please feel free to leave a comment: |
| 1080 |
|
| 1081 |
Thibault.Ralet\at ac-clermont.fr. |
| 1082 |
|
| 1083 |
Thank you! |
| 1084 |
|
| 1085 |
\end{document} |
| 1086 |
%% |
| 1087 |
%% This is file `ScratchX.sty', |
| 1088 |
%% |
| 1089 |
%% Copyright (C) Thibault Ralet - [email protected] |
| 1090 |
%% |
| 1091 |
%% 16 mars 2017 (version 0.1) - 27 juillet 2017 (version 1.1) |
| 1092 |
%% |
| 1093 |
%% the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt |
| 1094 |
%% |
| 1095 |
%% Unlimited copying and redistribution of this file are permitted as |
| 1096 |
%% long as this file is not modified. Modifications, and distribution |
| 1097 |
%% of modified versions, are permitted, but only if the resulting file |
| 1098 |
%% is renamed. |