First of all hello everyone I am new to Slick and I just started. I know how to pogram in Java but I want to start making games. Now I was just trying out the tutorials on the site when I stumbled on a little problem. When I run the code in the left corner “FPS: XXX” appears? I can’t find the code line that does this? Can someone explain this to me please?
Code:
package Game;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
public class Code extends BasicGame{
Image land = null;
Image plane = null;
float x = 400;
float y = 300;
float scale = 1.0f;
public Code(){
super("Van Hoeserlande Jordi");
}
public void init(GameContainer event) throws SlickException{
land = new Image("Land_Background.jpg");
plane = new Image("Plane_Image.png");
}
public void update(GameContainer event, int delta) throws SlickException{
Input input = event.getInput();
if(input.isKeyDown(Input.KEY_Q)){
plane.rotate(-0.2f * delta);
}
if(input.isKeyDown(Input.KEY_D)){
plane.rotate(0.2f * delta);
}
if(input.isKeyDown(Input.KEY_Z)){
float hip = 0.4f * delta;
float rotation = plane.getRotation();
x+= hip * Math.sin(Math.toRadians(rotation));
y-= hip * Math.cos(Math.toRadians(rotation));
}
if(input.isKeyDown(Input.KEY_S)){
float hip = 0.4f * delta;
float rotation = plane.getRotation();
x-= hip * Math.sin(Math.toRadians(rotation));
y+= hip * Math.cos(Math.toRadians(rotation));
}
}
public void render(GameContainer event, Graphics g) throws SlickException{
land.draw(0, 0);
plane.draw(x, y, scale);
}
public static void main(String[] args) throws SlickException{
AppGameContainer screen = new AppGameContainer(new Code());
screen.setDisplayMode(800, 600, false);
screen.start();
}
}