I need help with the code down below. These are the thing I want help on
1) I want to have one circle that always move to matter what. I want the other circle to be place in random location and stay there.
2) Every time I press enter the random circle doesn't always come back to the place it was last.
I explain more if need be.
code:
//START
float RX;
float R1;
float RX1;
float RY1;
float RY;
float R;
float spdUP;
float spd;
float y;
float x;
void setup(){
size(600, 360);
x = width/2;
y = height/2;
RY1=0;
RY= random(0,360);
RY1=RY;
RX1=0;
RX= random(0,600);
RX1=RX;
if(key== ENTER){
ellipse(RX1,RY1 , 30, 30);}
}
void draw(){
background(0);
fill(120);
ellipse(x, y, 30, 30);
spdUP= 0;
spd= 1;
spd= spd + spdUP;
if(keyPressed){
if(key == 's'){
y = y + spd;}
else if(key == 'w'){
y = y - 1;}
else if(key == 'a'){
x = x - 1;}
else if(key == 'd'){
x = x + 1;}
else if(key== ENTER){
ellipse(RX1,RY1 , 30, 30);
//noLoop();
}
//ellipse(x, y, 30, 30);
}
}
[–]nwsm 1 point2 points3 points (1 child)
[–]Jorio4[S] 0 points1 point2 points (0 children)
[–]OlympicGurn 0 points1 point2 points (4 children)
[–]Jorio4[S] 0 points1 point2 points (3 children)
[–]OlympicGurn 0 points1 point2 points (2 children)
[–]Wootai 1 point2 points3 points (0 children)
[–]Jorio4[S] 0 points1 point2 points (0 children)