Please join me in welcoming a new creature to Exercises in Flourishing:
The Interactive Game!
I have been waiting a long time to get into programming classes, and it all begins here with a course entitled Program Logic.
We won’t learn any true programming languages yet. The brilliant minds at MIT have devised a way to teach programming concepts though a colorful, training wheels environment called Scratch.
Anyone can download and use Scratch. There is an huge community of students and hobbyists uploading projects to the Scratch website every second.
But in other ways, Scratch is a lonely entity. Whatever I create in Scratch can only be played within the application, so I’m going to frequently link you to the Scratch website. There can you actually play my games and download them.
For my first game, I made a simple variation on classic Pong. I was proud of myself in that I bypassed Google Images and made my graphics myself! That’s right — I’m finally learning to approach my work with good old creative gumption, discovering that I CAN illustrate. (More on this in subsequent posts!)
So… what are you waiting for?
… or hang out here and read more about Scratch.
This is the basic layout of the program. To the left, I have a tray of all the different code pieces available to me, organized by category and color-coded. In the center is where I drag these pieces and fit them together in scripts. I have a monitor in the upper right where I can test my program in real time, and below that is where all my graphic assets (called sprites) are stored. You can see in this screenshot that the “ball” sprite is highlighted. That means that I am seeing only the scripts that belong to that sprite in the center pane. Other items have their own scripts that I can edit if I click their thumbnail.
Here is part the script that controls the functionality of my buoyant, blooming ball.
In the King’s English:
If the ball hits the log,
it must bounce in a direction opposite from whence it came.
Since this is a bit too predictable, we’ll let the computer randomly vary this angle within a range.
We want to keep track of the number of times the ball hits the log, because
after every five hits,
the ball should look like it has bloomed a bit more,
and it should move faster.
Every five hits, these two dynamics should progress.
It’s all so beautifully logical.