Move object in all ways with the arrows of the keyboard

Hello, I have this code and I'm new in the area of programming. I was wondering if someone could explain me how to move the object in all ways with the arrows of the keyboard.

PImage cohete;

int x;

int y;

void setup(){

size(600,600);

textSize(100);

cohete=loadImage("dibuix (2).png");

}

void draw(){

background(200);

image(cohete, x, y, 150, 200);

if (keyPressed){

 if (key == 'b' || key == 'B') {

x=x++;

}

}

}

I have this for the moment, I hope someone can help me

Tagged:

Answers

Sign In or Register to comment.