# Catching Pokemon with TikZ … and why ducks matter

A very creative professor once draw this picture while teaching about horizontal throw

which source is this video.

Once I saw it I tried to reproduce the draw as can be seen on my own, not very elegant, answer below.

My first attempt is indeed incredible ugly. I clearly don't have much skill with non-technical drawings.

Then I found out this interesting library of Pokemon's sprites as page numbering.

I really found very clever how each pokémon file was named as a number and this number is used at the respective page.

I used these sprites on my second attempt, which is much better than the first (horrible) attempt.

At this point I remembered the TikZ Ducks from TeX-Exchange and becoming a CTAN package.

The ducks TikZ package is incredible and has many options that makes me wonder: How could I do something similar with pokémons? I mean, creating commands to insert pokémon, by name and/or by number and some options.

I tried \newcommand{\pikachu}{def}, with def as a TikZ code inside a \begin{scope} \end{scope}, however it just didn't work very well.

My third attempt using ducks got really nice. It catches the concept without relying on external figures.

And that's why ducks matter. I would like to know how to create simple commands to insert pokémon, actually, to insert any other tikz-define command or a predefined set of images.

I've seen a incredible work of art with TikZ by reproducing the surprised Pikachu in TikZ. This is far better then the idea here but it is also complete out of my league.

As might be copyrights laws applied to official pokémon sprites, maybe something similar to what exists if someone searches for pokemon in Wolfram Alpha such as this Charizard could be used in TikZ.

I know about the tikzpgfmanual. Although it is a complete manual, it is not a simple task to directly learning some skills from it. I remember how much I improved when I learned about scope and only then I could dig into the manual knowing what I was looking for.

I'm not saying I will develop it of my own, but knowing the basics is a good start to develop the skills to do it or to contribute with it one day in the future.

Any ideas and suggestions are welcome.

• So... I herd u liek Mudkips! :) – Paulo Cereda Feb 28 '20 at 9:16

This is the main .tex code I used

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{ducks}
\begin{document}
\input{fig_TikZ_parabola_Pikachu}
\end{document}


since I like to create tikzpictures on separated files. This is the fig_TikZ_parabola_Pikachu.tex file.

\begin{tikzpicture}
% --------------------
\draw (-1,0) -- (9,0);
\foreach \x in {-1,-0.5,...,9} {
\begin{scope}[xshift=\x cm, green!50!black, very thick]
\draw (0,0) -- ++(-0.15,-0.15);
\end{scope}
};
\draw[dashed](0,0) -- ++(0,5);
\draw (0,0) -- ++(0,-1);
\draw[latex-latex] (0,-0.8) -- node[midway,above]{$x = ?$} ++(7.2,0);
\draw (7.2,0) -- ++(0,-1);
% --------------------

% --------------------
\draw[scale=1,domain=0:7,smooth,variable=\x,violet,dotted,very thick] plot ({\x},{-0.08*(\x)^2 + 5});
% --------------------

% --------------------
\begin{scope}[shift={(-1,5)}]
\draw[fill=red] (0,0) -- ++(0.8,0) arc (180:0:0.2) -- ++(0.8,0) arc (-180:0:-1);
\draw[fill=white] (0,0) -- ++(0.8,0) arc (-180:0:0.2) -- ++(0.8,0) arc (180:0:-1);
\draw[fill=white] (1,0) circle (0.2);
\draw[fill=black] (1,0) circle (0.1);
\end{scope}
% --------------------

% --------------------
% Pikachu Figure -- cute -- 3rd attempt
%\draw (6,0) pic [] {duck};
% --------------------

% --------------------
% Pikachu Figure -- cute -- 2nd attempt
\node at (7.5,1.5) {\includegraphics[width=3cm]{pikachu.png}};
% --------------------

% --------------------
% Pikachu in TikZ -- terrible -- 1st attempt
%\begin{scope}[shift={(5,0)}]
%   \draw[fill=yellow] (0.4,0) -- ++(2.9,0)
%   .. controls (3.5,0.7) and (3.5,0.9) ..
%   (3.2,1.6) -- (5.2,3.3) coordinate(OD) -- (2.7,1.8)
%   .. controls (2,2.1) and (1.3,2.1) .. (0.7,1.8) --
%   (-1.3,3.3) coordinate(OE) -- (0.2,1.5)
%   .. controls (-0.1,0.8) and (-0.1,0.6) ..
%   (0.1,0) -- cycle;
%   % --------------------
%   \draw[fill=red] (0.4,0.7) circle (0.2);
%   \draw[fill=red] (2.9,0.7) circle (0.2);
%   % --------------------
%   \draw[fill=black] (0.9,1.2) circle (0.2);
%   \draw[fill=black] (2.4,1.2) circle (0.2);
%   % --------------------
%   \draw[fill=white] (0.9,1.2) circle (0.05);
%   \draw[fill=white] (2.4,1.2) circle (0.05);
%   % --------------------
%   \draw[fill=black] (1,0.7) coordinate(B0) -- (2.3,0.7) coordinate(B1)
%   .. controls (1.9,0.2) and (1.3,0.2) .. cycle;
%   \draw[fill=white] (1,0.7) -- (2.3,0.7)
%   .. controls (1.9,0.5) and (1.3,0.5) ..
%   cycle;
%   % --------------------
%   \draw[fill=black] (OD) -- ++(-0.8,-0.7) -- +(-0.2,0.1) -- cycle;
%   % --------------------
%   \draw[fill=black] (OE) -- ++(0.6,-0.7) -- ++(0.2,0.1) -- cycle;
%   % --------------------
%\end{scope}
% --------------------

% --------------------
\node [rotate=90] at (-0.5,2) {$y = 45$ m};
\draw[blue, -latex] (0.5,3) -- node[midway, right]{$\vec{g} = 10 \dfrac{\mathrm{m}}{\mathrm{s}^2}$} ++(0,-2);
% --------------------
\draw[red, -latex] (1,5) -- node[midway, above]{$\vec{V}_0 = 5 \dfrac{\mathrm{m}}{\mathrm{s}}$} ++(2,0);
\draw[-latex] (5.7,3.9) node[above]{$t = 3$ s} -- ++(-0.6,-1);
% --------------------
\end{tikzpicture}


Each attempt is commented as a simple method to change between them.

The Pokéball is inspired at this draw.

The 1st attempt:

The 2nd attempt with external picture:

The 3rd attempt with ducks:

Happened to have this lying around, might be of some use. Cobbled together from lots of answers on this site!

\documentclass[17pt]{extarticle}
\usepackage[landscape,scale=.9]{geometry}
\thispagestyle{empty}
\pagestyle{empty}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}

\usepackage{tikz}
\usetikzlibrary{calc,angles}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{tikzducks}

\newcommand\qline{\tikz[dashed] \draw (0,0) -- +(3,0);}

\let\vec=\mathbf

%\url{https://tex.stackexchange.com/a/74613/86}
\usepackage{charter}
\usetikzlibrary{hobby,
shapes.geometric,
decorations,
decorations.shapes,
shapes.geometric,
patterns
}

\makeatletter
color(0cm)=(tikz@ball!20);
color(0.15cm)=(tikz@ball!30);
color(0.4cm)=(tikz@ball!60);
color(0.9cm)=(tikz@ball)
}

\pgfkeys{/tikz/easter star/.code args={#1 and #2}{
color(0cm)=(tikz@ball!20);
color(0.3cm)=(tikz@ball!40);
color(0.65cm)=(tikz@ball!60);
color(1cm)=(tikz@ball)
}
}
}

\makeatother

% original code by Paul Gaborit:
% tex.stackexchange.com/questions/72784/arrow-with-two-colors-with-tikz/#72793
\tikzset{
double path/.style args={#1 colored by #2 and #3}{
-,line join=round,line cap=rect,
shorten >=0.1cm,
shorten <=0.1cm,
line width=#1,#2, % first path
postaction={draw,-,#3,line width=(#1)/1.5,
shorten <=(#1)/3,shorten >=(#1)/3,
}, % second path
}
}

\tikzset{easter decoration 1/.style={
decorate,
decoration={
shape backgrounds,
shape=star,shape size=7pt,
shape sep={0.5cm, between center},
},
inner color=yellow,
outer color=yellow!50!orange,
draw=red!20!orange,
}
}

\pgfdeclarepatternformonly{fivepointed stars easter 2}{\pgfpointorigin}{\pgfpoint{10mm}{10mm}}{\pgfqpoint{10mm}{8mm}}%
{
\pgftransformshift{\pgfqpoint{1mm}{1mm}}
\pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
\pgfpathlineto{\pgfqpointpolar{162}{1mm}}
\pgfpathlineto{\pgfqpointpolar{306}{1mm}}
\pgfpathlineto{\pgfqpointpolar{90}{1mm}}
\pgfpathlineto{\pgfqpointpolar{234}{1mm}}
\pgfpathclose%
\pgfusepath{fill}
}

\tikzset{easter decoration 3/.style={
draw=green!17!yellow,
line width=2pt,
star,
}
}

\pgfdeclarepatternformonly{fivepointed stars easter 3}{\pgfpointorigin}{\pgfpoint{12mm}{12mm}}{\pgfqpoint{12mm}{11mm}}%
{
\pgftransformshift{\pgfqpoint{1mm}{1mm}}
\pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
\pgfpathlineto{\pgfqpointpolar{162}{1mm}}
\pgfpathlineto{\pgfqpointpolar{306}{1mm}}
\pgfpathlineto{\pgfqpointpolar{90}{1mm}}
\pgfpathlineto{\pgfqpointpolar{234}{1mm}}
\pgfpathclose%
\pgfusepath{fill}
}

% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

\begin{document}

\begin{tikzpicture}[every node/.style={font=\large}]
\foreach[
evaluate=\k as \tint using {5*(5-\k)+50},
evaluate=\k as \xk using {\k/10}
] \k in {0,...,5} {
\draw[line width=2mm, green!\tint!brown, line cap=round, line join=round] (0,-3) ++(\xk,\xk) ++(-1,0) -- +(2,0);
}
\draw[line width=2mm, brown, line cap=round, line join=round] (0,-3) -- (0,0) ++(-.5,-.5) +(0,2) -- coordinate[pos=.25](a) +(0,0) -- (.5,.5) --  coordinate[pos=.75](b) +(0,2);
\foreach[
evaluate=\k as \tint using {-5*\k+50},
evaluate=\k as \xk using {\k/10}
] \k in {0,...,5} {
\draw[line width=2mm, green!\tint!brown, line cap=round, line join=round] (0,-3) ++(-\xk,-\xk) ++(-1,0) -- +(2,0);
}
\path (a) ++(-3,-2) coordinate(c);
\draw[line width=2mm, red!50!brown, line cap=round, line join=round] (b) -- (c);
\path (c) ++(2.1,-.4) coordinate (d);
\begin{scope}[shift=(d), xscale=-1]
\duck
\end{scope}

\begin{scope}[transform canvas={shift={(17,1.5)},scale=.3,rotate=30},use Hobby shortcut]
%    \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 3};
% path clipping
\clip[scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\draw[easter bg color=green!77!blue,scale=-6,postaction={pattern=fivepointed stars easter 3,pattern color=green!20!yellow}]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);

\begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
\node[easter decoration 3,scale=2.25] at (0.55,0.65){};
\node[easter decoration 3,scale=1.5,rotate=10] at (1.45,1.45){};

\node[easter decoration 3,scale=1.5,rotate=-10] at (-0.5,1.95){};

\node[easter decoration 3,scale=1.65,rotate=-5] at (-0.75,-0.70){};

\node[easter decoration 3,scale=1.7,rotate=-3] at (0,-1.65){};

\node[easter decoration 3,scale=1.5,rotate=2] at (0.85,-0.65){};

\node[easter decoration 3,scale=1.75,rotate=14] at (2,0){};

\end{scope}
% draw again the border
\draw[scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\end{scope}

\draw[dashed,->,line width=1mm] (-2,0) to[out=45,in=135] coordinate(m) (17,0);
\draw[line width=2mm, red!50!brown, line cap=round, line join=round] (a) -- (c);
\draw[line width=2mm, brown, line cap=round, line join=round] (-.5,-.5) --  +(0,2);

\draw[rounded corners=10mm, brown!50!black,
decorate,decoration={snake,amplitude=.1mm,segment length=10}]
(16,0) to[bend right,looseness=2] +(2,0);
\draw[|<->|,ultra thick] (7.5,0) -- node[right] {$$h$$} (m);
\draw[|<->|,ultra thick] (-2,-2) -- node[below] {$$l$$} (17,-2);
\draw[ultra thick] (1,0) coordinate (A) -- (-2,0) coordinate(B) -- +(45:3) coordinate(C);
\pic[draw, ultra thick, angle eccentricity=1.5,angle radius=1cm, pic text=$$\alpha$$] {angle};
\end{tikzpicture}

Initial speed $$u$$ at angle $$\alpha$$, acceleration $$-g$$ vertically.

\begin{multicols}{2}

\begin{enumerate}
\item Initial velocity $$\vec{u} = \begin{pmatrix} \qline \\ \qline \end{pmatrix}$$
\item Vertical velocity $$v_y = \qline$$
\item Time to highest point $$t_m = \qline$$
\item Vertical position $$y = \qline$$
\item Height of highest point $$h = \qline$$
\item Time to landing $$t_l = \qline$$
\item Horizontal velocity $$v_x = \qline$$
\item Horizontal position $$x = \qline$$
\item Landing position $$l = \qline$$
\item Time in terms of horizontal position $$t = \qline$$
\item Vertical position in terms of horizontal position $$y = \qline$$
\end{enumerate}

\end{multicols}

\end{document}

• Why do you've such a thing lying around?! (+1 anyways!) – mrtaurho Feb 28 '20 at 15:12
• @mrtaurho Because I teach projectiles. – Andrew Stacey Feb 28 '20 at 21:20
• you changed the subject, from pokemon to angry birds... (-1) – jarnosz Mar 3 '20 at 19:38
• Let me correct a small misconception @errekak. Loop Space changed the subject from pokemon to angry ducks. Don't you agree? ;) – FHZ Mar 4 '20 at 22:37
• I stand corrected. (+2) – jarnosz Mar 5 '20 at 14:51

Here is why ducks matter.

\documentclass{beamer}
\usepackage{tikz,tikzducks}
\usepackage{tikzlings}
\usepackage{textcomp}
\newcommand{\musicnotes}{\raisebox{-2pt}{\raisebox{4pt}{\textmusicalnote}%
\textmusicalnote\hspace{2pt}% https://tex.stackexchange.com/a/458440
\raisebox{4pt}{\textmusicalnote}}}
\usetikzlibrary{shapes.geometric,shapes.callouts,calc}
\newcommand\MarmotSays[2][]{\only<.(1)>{
\node[ellipse callout, draw,fill=white,align=center,text width=2.5cm,
anchor=south east,
callout absolute pointer={(0.41,0.35)},#1] at (0.35,0.5)  {#2};
}}
\newcommand\CatSays[2][]{\only<.(1)>{
\node[ellipse callout, draw,fill=white,align=center,text width=2.5cm,
anchor=south west,
callout absolute pointer={(0.61,0.35)},#1] at (0.65,0.5)  {#2};
}}
\begin{document}
\begin{frame}
\begin{tikzpicture}[overlay,remember picture]
\pgfmathsetseed{123}
\foreach \X in {1,...,42}
{\pgfmathsetmacro{\myx}{rnd}%
\pgfmathsetmacro{\myy}{rnd}%
\ifnum\X=1
\xdef\LstStars{(\myx,\myy)}%
\else
\xdef\LstStars{\LstStars,(\myx,\myy)}%
\fi}
\fill (current page.south west) rectangle (current page.north east);
\begin{scope}[shift={(current page.south west)},%
x={($(current page.south east)-(current page.south west)$)},
y={($(current page.north east)-(current page.south east)$)}]
\only<7->{\foreach \X in {1,...,84}
{\pgfmathsetmacro{\myscale}{0.4*(1+2*rnd)/3}
\duck[shift={(rnd,rnd)},xscale=0.069*\myscale,yscale=0.1*\myscale,body=gray]}}
\foreach \X in \LstStars
{\path \X node[star,fill=yellow,inner sep={2*(1+rnd)*1pt}] {};}
\fill[gray] ([yshift=2cm]current page.south west) to[bend left=8]
([yshift=2cm]current page.south east) |- (current page.south west);
\cat[shift={(0.6,0.2)},xscale=0.069,yscale=0.1,eyes=green]
\marmot[shift={(0.42,0.2)},xscale=0.069,yscale=0.1,teeth,whiskers]
\MarmotSays{\musicnotes}
\pause
\CatSays[node font=\large\bfseries]{MEOW!}
\pause
\MarmotSays{I think we can talk normal. Nobody is watching us.}
\pause
\CatSays{Think so, too.}
\pause
\MarmotSays{BTW, did you know that 80\%
of the matter of our universe is duck matter?}
\pause
\CatSays{Really? I always
thought it was \emph{dark} matter.}
\pause
\CatSays{OK OK, I see your  point.}
\pause
\CatSays{There is indeed evidence for cold duck matter.}
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}


• I LOVED THE LAST FRAMES. Thank you. +1 – manooooh Feb 29 '20 at 5:23
• That was brilliant! – FHZ Feb 29 '20 at 13:45
• Isn't beamer connected to GTK+ something? – sanaris Feb 29 '20 at 20:27