Hi,
In my game I am using images that have some text. I have got it so that the images stop at a certain point, but not sure on how to get the images to continue on once I press the enter key. This is what I have so far:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Text here. * * @author (your name) * @version (a version number or a date) */ public class Text extends Tiles { private GreenfootImage[] Conversation1 = new GreenfootImage[7]; private GreenfootImage[] Conversation2 = new GreenfootImage[3]; private String fileName; private String fileNameDirectory; private int animationDelay = 30; private int animationDelayCounter; String fileNameSuffix = ".gif"; public Text(String selection) { this.selection = selection; if (selection == "Conversation1") { this.fileNameDirectory = "Text/Conversation/1/"; for (int i = 0; i < Conversation1.length; i++) { fileName = fileNameDirectory + (i+1) + fileNameSuffix; palletTownSign1[i] = new GreenfootImage(fileName); } } else if (selection == "Conversation2") { this.fileNameDirectory = "Text/Conversation/2/"; for (int i = 0; i < Conversation2.length; i++) { fileName = fileNameDirectory + (i+1) + fileNameSuffix; palletTownSign2[i] = new GreenfootImage(fileName); } } } /** * Act - do whatever the Text wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { animationDelayCounter++; if(animationDelayCounter == animationDelay) { animationCounter++; animationDelayCounter = 0; } if (selection == "Conversation1") { if (animationCounter > Conversation1.length - 6) { animationCounter = Conversation1.length - 6; } setImage (Conversation1[animationCounter]); } } }