//MovingBallDebug
float x,speedx;
void setup(){
size(255,200);
x = width/2;
y = height/2;
speedx = 0;
}}
void draw(){
background(255)
if(keyPressed ==true) {
if (key == "a") {
speedx = speedx - 0.1;
}
}else{
speedx=0;
}}
x=x +speedx;
constrain(x,0,width);
//plot ellipse
fill(x,155,255);
ellipse(x,y,50,50);
}
If you post a code you post it like:
Single-line : like this
Multiline :
also link the challenge you are onto
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.
Note: Backticks are not single quotes.

1 Like