I’m making a simplified game, were the cirkel has to collect trash. (It’s simplified a lot) But there is a challenge and that is that the cirkel cannot be hit by the cars.
BUT here’s my problem.
I can’t spawn infinite cars in because i need a delay between. (3-5 seconds)
Can anyone help me before monday PLEASE!
I have Discord if you want to talk or text with me about it. ~VOA_Rick~#5436
All my work so far down below:
//Car Variables
int s, t;
int s1, t1;
boolean CarDelay;
long reloadStartTime;
int wait = 5000;
float [] i = {205, 355};
//Trash Variables
//Random Variables
float o, p;
int c;
float x1, y1;
static int x, y;
float xDelta, yDelta;
static int w, h;
static int ww, hh;
static int gw, gh;
boolean bag;
final static byte FPS = 90;
//Setup
void setup(){
size(600, 900);
smooth();
frameRate(FPS);
c = #C8C8C8;
o = 525;
p = 825;
//---------
s = 205;
t = 0;
s1 = 10;
t1 = 10;
}
//Width/Height
static boolean north, south, west, east;
static final void initVars(int wdt, int hgt) {
x = wdt>>1;
y = hgt>>1;
w = wdt/15;
h = hgt/15;
ww = w>>1;
hh = h>>1;
gw = wdt - ww;
gh = hgt - hh;
}
void draw(){
//Road Structures
background(51);
rect(-10, -10, 150, 910);
fill(c);
rect(450, -10, 150, 910);
line(70, 0, 70, 900);
line(525, 0, 525, 900);
stroke(153);
strokeWeight(5);
line(300, 0, 300, 100);
line(300, 200, 300, 300);
line(300, 400, 300, 500);
line(300, 600, 300, 700);
line(300, 800, 300, 900);
//Bag
fill(0);
ellipse(o, p, 70, 40);
fill(c);
//----------------------------
//Cars
//s = s + s1;
t = t + t1;
rect(s, t, 40, 80);
rect(s, t, 40, 80);
//----------------------------
//Barriers
if(o > width - 20) {
o = 575;
}
if(o < 0 + 20) {
o = 25;
}
if(p > height - 20) {
p = 25;
}
if(p < 0 + 20) {
p = 875;
}
}
void keyPressed(){
final int k = keyCode;
if (k == ' ' | k == ENTER | k == RETURN)
bag = !bag;
if(key == 'a')
o = o - 25;
if(key == 'd')
o = o + 25;
}
void displayObject() {
if (bag) ellipse(x, y, w, h);
else rect(x, y, w, h);
}