Dear
As a beginner, I have rendered a car via rectangles and circles.
Actually, I want to move this car via mouse but I cant movie multiple shapes which created the car at the same time.
I would be grateful If you check out this code.
void setup()
{
size(700,700);
background(0);
}
void draw()
{
background(0);
pushMatrix();
translate(320,320);
fill(255,255,255,240);
rect(64,256,80,32);
rect(88,224,32,32);
fill(#030303 );
rect(96,234,18,18);
fill(#030303 );
circle(80,288,32);
circle(128,288,32);
stroke(255,255,255);
circle(80,288,16);
circle(128,288,16);
noStroke();
popMatrix();
}
micuat
April 18, 2021, 5:32pm
2
Hi! Welcome to the forum!
First of all please use </>
button to format your code.
Did you understand what pushMatrix
do? If so it should be quite straightforward to move multiple shapes at the same time
1 Like
glv
April 19, 2021, 9:21pm
3
Hello,
Please format your code:
FAQ - Processing Foundation
The Processing website has resources (tutorials, references, examples, etc.):
https://processing.org/
The Coding Train on YouTube also has some great lessons.
:)
jb4x
April 19, 2021, 9:25pm
4
Have you heard of classes?
Do you want to be able to move the car by moving the mouse anywhere on the screen or only if you click on the car?