Java game development tutorials: Animation... HELP

0 Antonio Exposito · July 29, 2015
Can anyone tell me why the following code is incorrect? It's from java game development tutorials 8-10:

import java.awt.Image;
import java.util.ArrayList;

public class Cat {
    private ArrayList scenes;
    private int sceneIndex;
    private long movieTime;
    private long totalTime;
    private Cat(){
    scenes = new ArrayList();
    totalTime = 0;
    //add scene to ArrayList and set time for each scene
    public synchronized void addScene(Image i, long t){
    totalTime += t;
    scenes.add(new OneScene(i, totalTime));
    //start animation from beginning 
    public synchronized void start(){
    movieTime = 0;
    sceneIndex = 0;
    //Change scene
    public synchronized void update(long timePassed){
    movieTime += timePassed;
    if(movieTime>= totalTime){
    movieTime = 0;
    sceneIndex = 0;
    while(movieTime > getScene(sceneIndex).endTime){
    //get animations current scene(aka image)
    public synchronized Image getImage(){
    return null;
    return getScene(sceneIndex).pic;
    private OneScene getScene(int x){
    return (oneScene)scenes.get(x);
             private class OneScene(){      
    Image pic;
    long endTime;
    public OneScene(Image pic, long endTime){
    this.pic = pic;
    this.endTime = endTime;

Post a Reply


Oldest  Newest  Rating
0 Henry Kato · July 31, 2015
Hi Guys, I am a complete newbie both on this forum and in the java development world. However I have been contacted by a bunch of High School Head teachers who are interested in a virtual lab software application for physics, chemistry and Biology. At first I thought it will be approached like a game where the characters are the different lab equipment, but I am really not sure. How should I approach this, and how best can I get started?
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator