Hello,
I just spent a moment on your code…
This should give you some ideas:
text(frameCount, 50,50);
if(frameCount%60==0)
{
spikes.add(new Spikes(width/2,500,50));
println(spikes.size());
}
if(spikes.size()>=10)
{
spikes.remove(0);
println(spikes.size());
}
You can look up the references to understand the code.
draw() \ Language (API) \ Processing 3+
frameRate() \ Language (API) \ Processing 3+
frameCount \ Language (API) \ Processing 3+
There are other timers that you can use if you desire. Search for these.
I often use frameCount() for quick code and examples where timing is not critical.
:)