JAVA**
so im trying to move my point continuously when a key is pressed it will only move that direction.
//arrow keys to draw
float x,y;
int speedY = 0;
int speedX = 1;
void setup(){
size(500,500);
background(255,255,255); //background white
x=150;
y=150;
stroke(0,0,0); //pen black
}
void draw(){
stroke(255,0,0);
point(x,y); //draw a point at current (x,y)
updatepoint();
}
void updatepoint(){
x = x + speedX;
y = y - speedY;
}
void keyPressed(){
if(key == CODED)
{
if (keyCode == UP && y>=0){ //restrict to screen edge
y=y-1;
}
else if(keyCode == DOWN && y<=500){
y=y+1;
}
else if (keyCode == LEFT && x>=0){
x=x-1;
}
else if (keyCode == RIGHT && x<=500){
x=x+1;
}
}
}
i was trying to use speedX and SpeedY but the next mistake happens when instead a continuous trail, it just makes multiple dots.