Phoenix Up
Phoenix Up

Reputation: 11

Objects not working in p5.js

I'm trying to make a water drop "simulation" in P5.js where the drops display a certain color based on where it is on the canvas, but when I start the local server it will not display or work. Any suggestions?
Edit I've uploaded it to GitHub so people can help me there. Water Rainbow

Upvotes: 0

Views: 234

Answers (1)

Kevin Workman
Kevin Workman

Reputation: 42176

You need to get into the habit of working in small pieces and checking your developer tools.

Write a line of code and test it out before writing a second line of code. You should not be writing your full program without testing the smaller pieces first.

The developer tools will tell you the error you're getting. This isn't valid syntax:

var RCo-ords = [];

Variable names can't contain dashes like this. Rename this variable.

If you haven't tested the smaller parts of this code in isolation, then it's very likely you'll have other errors. But this is the first one that jumps out at me. Start smaller and work your way forward in small steps instead of trying to debug your code only after you've written your whole project.

If you have follow-up questions, please post a MCVE (not your whole sketch!) in a new question, and we'll go from there. Good luck.

Upvotes: 1

Related Questions