In his poem, “The Opposite Game,” Brendan Constantine describes the experience of teaching antonyms to kids—translating each word of Dickinson’s famed “My life had stood a loaded gun,” verse into opposites.
Had stood Will sit
But what is the opposite of a gun?
I became obsessed with this poem after my friend N shared it this morning. I must have read it over a half-dozen times since.
(Sometimes the best refuge against the news is poetry.)
In the poem, the school kids tackle this question in earnest:
Flower, says one. No, Book, says another. That’s stupid,
cries a third, the opposite of a gun is a pillow. Or maybe
a hug, but not a book, no way is it a book. With this,
the others gather their thoughts
The discussion goes on and on.
Well, maybe. Maybe it’s everything we said. Maybe it’s
everything we didn’t say. It’s words and the spaces for words.
They’re looking at each other now. It’s everything in this room
and outside this room and down the street and in the sky.
It’s everyone on campus and at the mall, and all the people
waiting at the hospital. And at the post office. And, yeah,
it’s a flower, too. All the flowers. The whole garden.
The opposite of a gun is wherever you point it.
The opposite of a gun is wherever you point it. Such a good line.
In fact, the the whole poem is just so beautiful, through and through. Read it!
By the end of it, you’ve just imagined this world entirely made of NotGuns; the retrospective possibility and wholeness of that world…
All the life and beauty that might have filled an inverse-gun-space.
I wanted to use my newfound p5 object wizardry to invert guns into whatever the opposite of guns is: “Flower,” “book”…
object classes (guns & notGuns)
Here is a gun.
Here are a few examples of notGuns, some from the poem, some my own.
I wrote functions to draw each type of notGun, giving each drawing a this.x and this.y.
Some of the finnicky object shapes got divided into two functions.
One major challenge I faced was getting a mouse detection to work. I experimented with calling “checkMouse()” in different parts of the code. It seemed straightforward, but it didn’t work when I put it in my main gun-drawing loop.
My console log revealed uncooperative logic. I printed the distance amount and debugged.
storing values per object
Another challenge was limiting behaviors to specific stored objects in the arrays. I realized that every time I clicked to make a random notGun, the other notGuns would re-draw based on the random number I passed through.
In other words, there could only be one type of object at once, and they would all randomly change on mousePressed().
I realized that I had to put this in the constructor of the object, so that it doesn’t change with every for() loop through the array list.
My last wish was for something subtle and “ta-da”-feeling to happen after all guns become notGuns. I tried for a background change; I wanted it to fade more and more green as the majority of objects in the “guns” array returned “isGun() == false.”
I really struggled with this and putting this together with duct tape. Not the logic I wanted per se, but it works!
Once all guns have been transformed into nonGuns, the background turns green and peaceful.
bonus round: POISSON?! 🐟
This part was kind of extra-extra credit, for myself. Originally I really wanted to position the sprites in a more regular (but still slightly random) grid. I tried to generate the guns in a 2D array, but ended up with three for() loops and something was whack with that.
J forwarded me something called Poisson Disk Sampling. It’s a really legit thing—there’s even a Very Serious Paper explaining how this works. This would have given me exactly the effect I wanted.
You can read watch Dan Shiffman talk about it here.
I tackled this twice, and failed both times to even get points to appear. Skill-wise, it’s a little out-of-my-league, for now. I would like to try again sometime though. 💪