if anyone can help me get this sample code running i would much appreciate it thanks in advance. Ok B4 you flame me i should just let you know that i am new to java. when i read java code i can understand it and i can write it but when it comes to setting up the compiler am still learning.
I followed the instructions on this website
http://www.gaanza.com/blog/tag/slick-2d-with-netbeans/ on how to get slick and netBeans setup i am very confident that i followed the instructions down to a T and that slick is working.
the problem am running into now is the last and final step, that is Step 8.
It says to "Create a new java project called SlickTest"
i did that, after i created the project i got a new editing window called Main.java
and here is whats in it.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sllicktest;
/**
*
* @author Chalise
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
then it says to create a class called Test i did that and the following is whats in it.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Chalise
*/
public class Test {
}
Then they gave me the following code to test.
package com.padam.testing;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
/**
*
* @author padam
*/
public class Test extends BasicGame{
public Test(String name){
super(name);
}
public static void main(String[] args){
try {
AppGameContainer container = new AppGameContainer(new Test(”Game”));
container.setDisplayMode(800,600,false);
container.start();
} catch (SlickException e) {
e.printStackTrace();
}
}
@Override
public void init(GameContainer gc) throws SlickException {
}
@Override
public void update(GameContainer gc, int delta) throws SlickException {
}
public void render(GameContainer gc, Graphics g) throws SlickException {
}
}
It doesn't say to paste this code in Main.java or Test.java the class i just created. but i am assuming i have to paste the code inside my class and so here we go!
package com.padam.testing;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
/**
*
* @author padam
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Chalise
*/
public class Test {
public class Test extends BasicGame{
public Test(String name){
super(name);
}
public static void main(String[] args){
try {
AppGameContainer container = new AppGameContainer(new Test("Game"));
container.setDisplayMode(800,600,false);
container.start();
} catch (SlickException e) {
e.printStackTrace();
}
}
@Override
public void init(GameContainer gc) throws SlickException {
}
@Override
public void update(GameContainer gc, int delta) throws SlickException {
}
public void render(GameContainer gc, Graphics g) throws SlickException {
}
}
}
My problem lies here. when i try to build the program these are the errors i get.
C:\Users\Chalise\Documents\NetBeansProjects\SllickTest\src\Test.java:25: com.padam.testing.Test is already defined in com.padam.testing
public class Test extends BasicGame{
C:\Users\Chalise\Documents\NetBeansProjects\SllickTest\src\Test.java:33: non-static variable this cannot be referenced from a static context
AppGameContainer container = new AppGameContainer(new Test("Game"));
C:\Users\Chalise\Documents\NetBeansProjects\SllickTest\src\Test.java:31: inner classes cannot have static declarations
public static void main(String[] args){
3 errors
BUILD FAILED (total time: 0 seconds)
Does anybody have a clue as to what i need to do?