» codelab : http://codelab.fr/accueil » Forum : Processing : http://codelab.fr/processing » Background scrolling : http://codelab.fr/4832 Ceci est la version imprimable d'un sujet du forum, pour retourner à la version complète : Background scrolling |
Naokao — 2014-02-21 15:19:20 |
Ola amis codeux, |
Mushussu — 2014-02-21 16:38:23 |
Bonjour, PImage img; int index; void setup() { size(640, 480); img = loadImage("imago.jpg"); index = 0; } void draw() { image(img, 0, index - height); image(img, 0, index); } void keyPressed() { if (keyCode == UP) { index -= 5; if (index < 0) { index = height + index; } } if (keyCode == DOWN) { index += 5; if (index > height) { index = index - height; } } } |