Processing Lab help!
in
Programming Questions
•
1 year ago
Computer Processing Lab Question!! Please help.?
So my lab in my computer science class is to write code that will make a circle take 10 steps (5 pixels a step) then change direction randomly from the four cardinal directions (Up, Left, Right, Down) and go 10 steps etc.
This is how far I am now. Please Please help!
int myX = 300;
int myY = 300;
int myXSpeed = 5;
int myYSpeed = 5;
int choice = 10;
void setup ()
{
size ( 600 , 600 );
background ( 200 );
}
void draw ()
{
ellipse ( myX , myY , 30 , 30 );
myX= myX + myXSpeed;
if (( myX > width ) || ( myX < 0 ))
{
myXSpeed = myXSpeed * -1;
}
}
This is how far I am now. Please Please help!
int myX = 300;
int myY = 300;
int myXSpeed = 5;
int myYSpeed = 5;
int choice = 10;
void setup ()
{
size ( 600 , 600 );
background ( 200 );
}
void draw ()
{
ellipse ( myX , myY , 30 , 30 );
myX= myX + myXSpeed;
if (( myX > width ) || ( myX < 0 ))
{
myXSpeed = myXSpeed * -1;
}
}
1