ArrayList - having different images when moving using arrow keys

you need to store for each Image individually where it is pointing.

So make a new class PointingImage:

PImage image;
int pointingDirection  = 0; // 0 is up, 1, east, 2 south, 3 west 

Replace

ArrayList <PImage> images;

with

when a key is pressed loop over the images and display only where the key matches the pointingDirection

1 Like