We are about to switch to a new forum software. Until then we have removed the registration on this forum.
if(second()%2==0){
seconds=second();
b.add(new Bullets(mouseX));
}
here is the code i have but it creates a wall how would you suggest fixing it?
edit: fixed if (b.get(0).y%200==0) b.add(new Bullets(mouseX)); if (b.get(0).y<=0) b.remove(0);
Answers
Draw is called about 60 times a second so you'll get about 60 draw loops for each second = 60 new things
By default, frameRate() is 60 FPS. Therefore 2 seconds = 2 * FPS = 120 frameCount.
Translating that for frameCount + modulo
%
, we've got: *-:)if (frameCount % 120 == 0) bullets.add(new Bullet());