Programador:
Jaume Mas
Instruccions:
Utilitza les tecles amb fletxes per a moure la nau. (si no funciona, clica primer amb el ratolí sobre l’sketch.)
Codi:
PImage tie;
float x, y, vel=10;
void setup() {
size(900, 600);
tie = loadImage(“caza_tie3.png”);
}
void draw () {
background(0);
if (keyPressed) {
if (key == CODED) {
if (keyCode ==LEFT) {
x = x-vel;
}
if (keyCode ==RIGHT) {
x = x+vel;
}
if (keyCode ==UP) {
y = y-vel;
}
if (keyCode ==DOWN) {
y = y+vel;
}
}
}
image(tie, x, y);
}