This post in reply to the Post, Plotting Pacman

I've received a suggestion offline saying that I should animate the Pacman. There are two items to animate: Pacman's mouth and pac-dots. To review how pacman's mouth moves, please have a quick look at Google Pacman doodle.

Pacman's mouth only has three stages: open, half open and close. Let's take the pacman that I created in the previous post. Each frame of the animation is done by adjusting the radian values of the "pie" (aka Pacman's body and mouth).

body := proc(n) 
plots[display](
plottools[pieslice]([0, 0], 5, (1/6)*Pi-(1/12)*n*Pi .. (11/6)*Pi+(1/12)*n*Pi,
color = yellow)
)
end proc;
plots[animate](body, [n], n = [0, 1, 2, 1], title = "", axes=none);

Let's put some Pac-dots on Pacman's way.

frame := proc(n) 
plots[display](
[ plots[pointplot]([[5.5-(mod(n, 2)), 0], [7.5-(mod(n, 2)), 0], [9.5-(mod(n, 2)), 0]],
color = black, symbol = solidcircle, symbolsize = 30),
plottools[pieslice]([0, 0], 5, (1/6)*Pi-(1/12)*n*Pi .. (11/6)*Pi+(1/12)*n*Pi,
color = yellow)
]
)
end proc;
plots[animate](frame, [n], n = [0, 1, 2, 1], title = "", axes = none);

(Easy) Challenge problem: Animate how Pacman disintegrates when one life is lost.

It would be lovely if someone can plot a 3D Pacman! :)


Please Wait...