Does anyone know how to move multiple shapes as one? Like how you can move a circle with W,A,S,D or arrow keys and make it move up, down, left and right, how can this be done for lets say two rectangles that are ontop of each other? Im completely lost with this and dont know how to do it
Also i use processing v3.5 and im a complete beginner so any help would be greatly appreciated as i cant seem to find any tutorials anywhere on this
I think i failed to explain my problem clearly so i apologise for that, i want to move two or multiple shapes as one shape so in the example you sent, i dont want the two circles to move seperately with different keys i want the two circles to move as one so when i click the D key or the right key, both circles move to the right at the same time, sorry for the confusion
Well, in my sketch I have a 2D array representing the 4 movement keys for the 2 Player objects:
static final byte[][] KEYS = {
{ +'W', +'S', +'A', +'D' }, { UP, DOWN, LEFT, RIGHT }
};
You can simply repeat the same keys for both Player objects:
static final byte[][] KEYS = {
{ +'W', +'S', +'A', +'D' }, { +'W', +'S', +'A', +'D' }
};
I see. Thank you for that