itch.io is community of indie game creators and players

Devlogs

DMSC Devlog: Week 2 - Made for Walking

One week into a programming class and the training wheels are coming off! After last class's warm-ups with LOGO, a language designed with sixth-graders in mind, we have graduated to the very adult JavaScript library p5.js. It's taking some getting used to, but a semester of learning Processing-style Java last year has proven immensely helpful - plus, it's nice to not have to write your code perfectly before you run it. Most of our focus is on generating visuals, starting with the most basic functions of creating a canvas, drawing shapes, and making pictures change with if statements and for loops. Even with just these tools, the possibilities are endless!

Step 1 of the p5 journey was making a black rectangle appear on different sides of our canvas.

Basic, but we have to start somewhere.

A failed attempt - "currentX" and "currentY" are used as starting coordinates for all future points, but never change outside of setup().
The variable "frameCount" is an easy always-increasing number to stick in noise() functions. The "+ 10000" just makes X and Y different numbers.
As I later learned, noise() produces a value between 0 and 1, used in this instance as percentages of the length and width of the canvas - in other words, the circle's coordinates will never reach 0, width, or height.
My eventually successful Perlin walker...

All the final program was missing was a ball to do the walking. And a trail marker a different thickness than the ball.

Put them together:

And we've done it! No flashy designs, no text or walls to bump into or colorful floating iceberg, just hours of messing with arrays and percentages. I'll see if I can't stick a smiley face or a picture of an ice cube on the end of it to top it off.

This Perlin noise stuff is cool! I don't totally understand (at all in any capacity) how adding more dimensions to the noise() function works, but this whole exercise seems like a good, if time-consuming, starting point. Looking forward to using it again maybe eventually!

-Rafi