How to make all the shapes move together


#1

I’m trying to make a spaceship composed of these various shapes. I need help making them move all together with arrow keys. What I have is shown below

var player;

//spaceship();

var img = createGraphics(100, 100,RGB);
img.background(15, 14, 20);
var draw = function() {
var spaceX = 130;
var spaceY = 100;
img.fill(245, 19, 83);
img.rect(spaceX, spaceY, 81, 65);
img.triangle(170, 27, 130, 100, 212, 100);
img.triangle(212, 100, 212, 165, 258, 207);
img.triangle(130, 100, 130, 164, 88, 207);
};

function setup() {
player = createSprite(width/2, height -25, 50, 50)
player.maxSpeed = 2;
drawSprites();