Ask coding questions

← Back to all posts
whats wrong with this code
Scottyh123 (0)

void setup()
{
size(500, 500);
particles = new ArrayList < Particle >();
}

void draw()
{
background(20, 25, 50);
textSize(50);
text(particles.size(), width - 150, 75);
for(int i = 0; i < particles.size(); i ++)
{
particles.get(i).update();
}
for(int i = 0; i < particles.size(); i++)
{
particles.get(i).display();
}
if(mousePressed && coolDown == 0)
{
for(int i = 0; i < 25; i++)
{
particles.add(new Particles(mouseX, mouseY));
}
coolDown = 15;
}
if(coolDown > 0)
{
coolDown = coolDown - 1;
}

}

Comments
hotnewtop
Coder100 (16864)

you have to do this in processing environment!!!
https://replit.com/@templates/Processing

MocaCDeveloper (560)

Lol. None of that code is stored inside a class/static class function. That's your problem.

SixBeeps (5047)

Hi, what's issues are you experiencing with your code? Also, could you paste that code into a Repl and link it so that we can run it?