Hey everyone, I'm a beginner to processing and i've made a little slideshow that I want implemented into another class.
PImage[] images = new PImage[5];
int counter; // Automatically initialized at 0
final int DISPLAY_TIME = 10000;
int lastTime; // When the current image was first displayed
boolean cinematic = true;
void setup()
{
size(880, 660);
for (int i = 0; i < images.length; i++)
{
images[i] = loadImage("cine" + nf(i+1, 2) + ".jpg"); // nf() allows to generate 01, 02, etc.
}
lastTime = millis();
}
void draw()
{
background(255);
fill(0);
if (millis() - lastTime >= DISPLAY_TIME) // Time to display next image
{
counter = ++counter;
if(counter == 5){
cinematic = false;
}
lastTime = millis();
}
if(cinematic){
image(images[counter], 0, 0);
}
}
I want to use the draw function of that class in another one of my classes, because i'm making a game and this is somewhat similar to a simple cutscene, so I want to call this draw once and then be gone with it and my game load up.