All right, I call this one the function eater, maybe too many Arnold Schwarzenegger movies, but it
kind of suited because we did want to try out and work a lot with functions and get more familiar with
what functions can do in this than this section.
So the objective here is to listen for key presses.
We're going to be listening for a sequence to be added in and we're going to store this as an array.
And then once the user is ready to run the sequence of up, down, right, left and also changing the
color, they can press the spacebar or the enter and that's going to run the sequence of where that
element is going to move.
You can also select and update the sequence by clicking and removing the different maneuvers that are
already preset within the sequence.
And this is a really fun and interesting one.
And we'll really get you familiar with functions as well as element manipulation.
Let me show you.
So we're presented with a box, a regular element, and I can enter in some pressing my keyboard keys.
I've got right down, left up all of these.
I can proceed to change the color of the output.
And then also, whenever I'm ready to run the sequence, I almost forgot.
I can also remove items from the sequence.
So let's say I put way too many rights.
I can just simply click them and remove them.
I'm going to do some down and hopefully it stays on the screen.
Let me press space and we'll see it moving around.
So it's moving around the screen now according to what the commands are.
And then once it completes, you see that we can set new commands again.
We can set the path again.