rj
02-27-2014, 01:54 AM
So more Java trouble here -.-
When I try to initialize a game object
GameObject spike = new GameObject(40, 40, new TBox(40, 40, 80, 80), 10, 5000, "spike.png");
I get this error:
http://i.imgur.com/BDOzDBX.png
Here is what my game object class looks like
package main;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
class GameObject {
private final int x, y;
private final TBox currentBounds;
private final int damage, value;
private final String fileName;
private final BufferedImage Img;
public GameObject(int x, int y, TBox currentBounds, int damage, int value, String fileName) throws IOException {
this.x = x;
this.y = y;
this.damage = damage;
this.currentBounds = currentBounds;
this.value = value;
this.fileName = fileName;
this.Img = ImageIO.read(new File(fileName));
}
}
Just spent the last 40 minutes looking for answers all I found was to put super(); after
public GameObject(int x, int y, TBox currentBounds, int damage, int value, String fileName) throws IOException {
but I still got the error
When I try to initialize a game object
GameObject spike = new GameObject(40, 40, new TBox(40, 40, 80, 80), 10, 5000, "spike.png");
I get this error:
http://i.imgur.com/BDOzDBX.png
Here is what my game object class looks like
package main;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
class GameObject {
private final int x, y;
private final TBox currentBounds;
private final int damage, value;
private final String fileName;
private final BufferedImage Img;
public GameObject(int x, int y, TBox currentBounds, int damage, int value, String fileName) throws IOException {
this.x = x;
this.y = y;
this.damage = damage;
this.currentBounds = currentBounds;
this.value = value;
this.fileName = fileName;
this.Img = ImageIO.read(new File(fileName));
}
}
Just spent the last 40 minutes looking for answers all I found was to put super(); after
public GameObject(int x, int y, TBox currentBounds, int damage, int value, String fileName) throws IOException {
but I still got the error