This was SO MUCH FUN!! I’ve never used processing to display visuals on a computer screen, so all the shape stuff was very new and exciting to work with. I originally wanted to do some sort of animation with the 1 and 20, and to have arms and legs for the diceboy, but ran into a lot of issues that were just out of my depth at this point. Definitely went about a lot of this backwards; I feel like the whole code could’ve been 70% shorter. Major speedbumps I had:
— how to draw an icosahedron when I don’t know fancy maths? (I ended up just eyeballing a lot of it and basing it from the center of the canvas so it would naturally adjust to variable canvas sizes)
—is there a way to have a variable canvas size based on the user’s screen?
— how to draw arms and legs? I couldn’t seem to figure out how to draw an ellipse() at an angle, tried messing with the 5th variable value, but nothing seemed to work.
— how to simplify the loop? I tried defining a couple arrays to hold the d20 values and their corresponding colors, but I’m not terribly familiar with processing or javascript, so couldn’t figure out why something like this wouldn’t work:
var d20color = [(255, 0, 0), (255. 255, 0), (0, 0, 255)];
background(d20color[2]);
— is there an easier way to define variables by the width and height without having to declare them in each local function? I was hoping to just define them at the top like with var d, but then realized they didn’t have the width or height yet because those would have been declared after, in setup().
— when testing this on mobile, i had to be really quick and deliberate with my presses, or else it would register two presses. I figured some sort of debounce was built-in, but confused now.
It’s interesting to try and answer the question as to how computation applies to my interests…. I guess it’s hard because that first requires me to narrow down my interests… I think I’ll shoot for low-hanging fruit on this one since it’s past midnight and I still have another class’ worth of homework to do — I’m into games. If it wasn’t obvious by now, I love Dungeons and Dragons — I had my dice on me in class because some Thursday nights I’m a dungeon master for hire. So when searching for inspiration for this assignment, I took the Math.random d20 example from class and ran with it. Learning more programming excites me because I’ll be able to rapidly expand my toolset for building interactive experiences, including developing code for some live games that I want to have digital elements. Overall, excited to have this proof of concept, and eager to look back on my clunky code in a few months with leagues more wisdom (+4 WIS?). Too bad it’s too clunky to be worth actually implementing at the table, but fun nonetheless.
May you always roll 20’s,
August
code at the p5.js web editor and github:
https://editor.p5js.org/DeadAugust/sketches/SyJVKR8dm
https://github.com/DeadAugust/ITP-ICM/blob/master/d20boy