Slick addState java.lang.Error -



Slick addState java.lang.Error -

ok, i'm doing wrong , can't figure out what. i'm next tutorial building simple game slick. know there nil in code, @ point code should able compile.

package javagame; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class game extends statebasedgame{ public static final string gamename = "game name!"; public static final int menu = 0; public static final int play = 1; public game(string gamename){ super(gamename); this.addstate(new menu(menu)); this.addstate(new play(play)); } public void initstateslist(gamecontainer gc) throws slickexception{ this.getstate(menu).init(gc, this); this.getstate(play).init(gc, this); this.enterstate(menu); } public static void main(string[] args) { appgamecontainer appgc; try{ appgc = new appgamecontainer(new game(gamename)); appgc.setdisplaymode(640, 360, false); appgc.start(); }catch(slickexception e){ e.printstacktrace(); } } }

and here classes

package javagame; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class play { public play(int state){ } public void init(gamecontainer gc, statebasedgame sbg) throws slickexception{ } public void render(gamecontainer gc, statebasedgame sbg, graphics g) throws slickexception{ } public void update(gamecontainer gc, statebasedgame sbg, int delta) throws slickexception{ } public int getid(){ homecoming 1; } }

and

package javagame; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class menu { public menu(int state){ } public void init(gamecontainer gc, statebasedgame sbg) throws slickexception{ } public void render(gamecontainer gc, statebasedgame sbg, graphics g) throws slickexception{ } public void update(gamecontainer gc, statebasedgame sbg, int delta) throws slickexception{ } public int getid(){ homecoming 0; } }

the error:

exception in thread "main" java.lang.error: unresolved compilation problems: method addstate(gamestate) in type statebasedgame not applicable arguments (menu) method addstate(gamestate) in type statebasedgame not applicable arguments (play) @ javagame.game.<init>(game.java:12) @ javagame.game.main(game.java:25)

as game extends statebasedgame , not override addstate(), when this.addstate(new menu(menu)); trying phone call method defined in statebasedgame api referance

so menu , play class should sub class of gamestate

java

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -