We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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
Answers
When posting code, make sure you use the code button to properly format it.
What exactly do you mean by "moving in all ways"?
Here is an example that shows you how to use the arrow keys to animate a moving ball in Processing: http://staticvoidgames.com/tutorials/intermediateConcepts/keyboardInput
http://studio.processingtogether.com/sp/pad/export/ro.91tcpPtI9LrXp/latest