Well, I’ve spent part of last week setting up a class that draws hedgehogs. I knew it wasn’t going to be the most stunning drawing, but I wanted to at least grasp the logic necessary to make one appear on the canvas.
I kept getting an error message saying that my class “Hedgie” wasn’t defined. I checked and re-checked my syntax, took a break and worked on PComp, watched the videos again, read the chapter on Objects, came back, still couldn’t make the hedgehog appear.
Frustrated, I duped the ball sketch and replaced that code with mine. I figured I was missing some syntax that I glanced over. I at least got it to draw a hedgehog, but why isn’t it drawing two?
Here is my code- dear god someone help!
*Update (1 of many)* so the hedgehog displaying was an illusion, I had to restart my computer- I think I might’ve crashed p5.js. I replayed my sketch and I’m getting the same error message:
I’m going to sign up for some office hours and sort this out. I will solve this!
*UPDATE* I didn’t update my index and that’s why it kept saying Hedgie was undefined. Hoorayyyyy!
The other thing I discovered was that the hedgehogs were being printed over one another. In order to get them to display correctly and move, I had to fix my class. I had variables but I wasn’t using any of them. When I was corrected on this, I started laughing hard. Whoops!
Variables: YOU ACTUALLY HAVE TO USE THEM.