processing-game/program.pde
2023-09-28 23:38:04 +02:00

43 lines
515 B
Plaintext

int x;
int y;
void setup(){
size(800,800);
rectMode(CENTER);
}
void draw(){
rect(x, y, 50, 50);
}
void keyPressed()
{
if (key == CODED)
{
if (keyCode == LEFT)
{
//if (directionX>0) {
x--;
//}
}
else if (keyCode == RIGHT)
{
//if (directionX<0) {
x++;
//}
}
else if (keyCode == UP)
{
//if (directionY<0) {
y--;
//}
}
else if (keyCode == DOWN)
{
//if (directionY<0) {
y++;
//}
}
}
}