Como fazer um jogo RPG 2D em java? (slick2d)

Olá pessoal!,
eu estou desenvolvendo um RPG 2d, só que estou usando uma tecnica que acredito
ser muito primitiva!..

code:

package source;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.Color;
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;
import org.newdawn.slick.SpriteSheet;

public class Component extends BasicGame {
	
	public static int[][] WorldMap = {
	     {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
	     {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2},
	     {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2},
	     {2, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2},
	     {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, 1, 1, 1, 1, 2},
	     {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2},
	     {2, 1, 4, 4, 4, 4, 3, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2},
	     {2, 1, 3, 5, 5, 5, 3, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 2},
	     {2, 1, 3, 5, 5, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2},
	     {2, 1, 3, 5, 5, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2},
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, 2, 2, 2, 2, 2, 2, 2, 2},
	};
	
	public static int dir = 0;
	
	public static int sX = 0;
	public static int sY = 0,
			px = 0,
			py = 0,
			tileSize = 32;
	
	public static SpriteSheet tile;
	
	public static boolean up = true, down = true, left = true, right = true;
	
	public void drawPlayer(Graphics g) {
		g.drawImage(tile.getSprite(0, 0), 288, 288-64);
		px = 288-sX;
		py = (288-64)-sY;
	}
	
	public static boolean isColl(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2) {
		return(x1 <= x2 && x1+w1 >= x2 && y1 <= y2 && y1+h1 >= y2 || x2 <= x1 && x2+w2 >= x1 && y2 <= y1 && y2+h2 >= y1);			
	}
	
	public void move() {
		int speed = 1;
		
        if(dir == 1) {
            Component.sY -= speed*32;
        } else if(dir == 2) {
            Component.sY += speed*32;
        } else if(dir == 3) {
            Component.sX += speed*32;
        } else if(dir == 4) {
            Component.sX -= speed*32;
        }
        else if(dir == 0) {}
    }
	
	public Component() {
		super("MyRPG");
	}
	
	//tiles
	public static Image
	grass, character, fence, wallDown, wallUp,
	doorOpen, doorClosed, ground, tree, flowers1,
	flowers2;
	
	public void init(GameContainer container) throws SlickException {
		tile = new SpriteSheet("res/maptiles.png", 32, 32);
		
		grass = tile.getSprite(1, 7);
		character = tile.getSprite(0, 0);
		fence = tile.getSprite(4, 7);
		wallUp = tile.getSprite(0, 7);
		wallDown = tile.getSprite(6, 7);
		doorOpen = tile.getSprite(2, 7);
		doorClosed = tile.getSprite(3, 7);
		ground = tile.getSprite(7,7);
		tree = tile.getSprite(5,6);
		flowers1 = tile.getSprite(8,7);
		flowers2 = tile.getSprite(9,7);
	}
	
	public void update(GameContainer container, int delta) throws SlickException {
		Input input = container.getInput();
		
		dir = 0;
		for(int x = 0; x < WorldMap[0].length; x++) {
	        for(int y = 0; y < WorldMap.length; y++) {
				if(input.isKeyPressed(Input.KEY_W) && up) {
					dir = 2;
				}
				if(input.isKeyPressed(Input.KEY_S) && down) {
					dir = 1;
				}
				if(input.isKeyPressed(Input.KEY_A) && left) {
					dir = 3;
				}
				if(input.isKeyPressed(Input.KEY_D) && right) {
					dir = 4;
				}
		    }
		}
		
		move();
	}
	
	public void render(GameContainer container, Graphics g) throws SlickException {
		int dx = px/tileSize;
		int dy = py/tileSize;
		for(int x = 0; x < WorldMap[0].length; x++) {
	        for(int y = 0; y < WorldMap.length; y++) {
	           	if(WorldMap[x][y]==1) {
	        		g.drawImage(grass, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==2) {
	        		g.drawImage(fence, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==3) {
	        		g.drawImage(wallUp, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==4) {
	        		g.drawImage(wallDown, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==5) {
	        		g.setColor(Color.black);
	        		g.fillRect(sX+x*tileSize, sY+y*tileSize, tileSize, tileSize);
	        	} else if(WorldMap[x][y]==6) {
	        		g.drawImage(doorOpen, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==7) {
	        		g.drawImage(doorClosed, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==8) {
	        		g.drawImage(ground, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==9) {
	        		g.drawImage(tree, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==10) {
	        		g.drawImage(flowers1, sX+x*tileSize, sY+y*tileSize);
	        	} else if(WorldMap[x][y]==11) {
	        		g.drawImage(flowers2, sX+x*tileSize, sY+y*tileSize);
	        	}
	           	if(dx > 0 && dx < WorldMap[0].length && dy > 0 && dy < WorldMap.length) {
	           		if(WorldMap[dx][dy] == 6) {
	           			for(int i = 0; i < 3; i++) {
	           				for(int j = 0; j < 3; j++) {
	           					WorldMap[7+i][3+j] = 8;
	           				}
	           			}
	           			WorldMap[dx][dy] = 7;
	           		} else if(WorldMap[dx][dy-1] != 1
	           				&& WorldMap[dx][dy-1] != 6
	           				&& WorldMap[dx][dy-1] != 0
	           				&& WorldMap[dx][dy-1] != 7
	           				&& WorldMap[dx][dy-1] != 8
	           				&& WorldMap[dx][dy-1] != 11
	           				&& WorldMap[dx][dy-1] != 10) {
	           			up = false;
	           		} else {
	           			up = true;
	           		}
	           		if(WorldMap[dx][dy+1] != 1
	           				&& WorldMap[dx][dy+1] != 6
	           				&& WorldMap[dx][dy+1] != 0
	           				&& WorldMap[dx][dy+1] != 7
	           				&& WorldMap[dx][dy+1] != 8
	           				&& WorldMap[dx][dy+1] != 11
	           				&& WorldMap[dx][dy+1] != 10) {
	           			down = false;
	           		} else {
	           			down = true;
	           		}
	           		if(WorldMap[dx-1][dy] != 1
	           				&& WorldMap[dx-1][dy] != 6
	           				&& WorldMap[dx-1][dy] != 0
	           				&& WorldMap[dx-1][dy] != 7
	           				&& WorldMap[dx-1][dy] != 8
	           				&& WorldMap[dx-1][dy] != 11
	           				&& WorldMap[dx-1][dy] != 10) {
	           			
	           			left = false;
	           		} else {
	           			left = true;
	           		}
	           		if(WorldMap[dx+1][dy] != 1
	           				&& WorldMap[dx+1][dy] != 6
	           				&& WorldMap[dx+1][dy] != 0
	           				&& WorldMap[dx+1][dy] != 7
	           				&& WorldMap[dx+1][dy] != 8
	           				&& WorldMap[dx+1][dy] != 11
	           				&& WorldMap[dx+1][dy] != 10) {
	           			right = false;
	           		} else {
	           			right = true;
	           		}
	           	}
			}
		}
		drawPlayer(g);
	}

	public static void main(String[] args) {
		try {
			AppGameContainer app = new AppGameContainer(new Component());
			app.setShowFPS(false);
			app.start();
		} catch (SlickException e) {
			e.printStackTrace();
		}
	}
}

Eu queria ajuda para simplificar o sistema de colisao e o de inicializar images:

else if(WorldMap[x][y]==11) {
	        		g.drawImage(flowers2, sX+x*tileSize, sY+y*tileSize);
	        	}

se alguem puder me ajudar agradeco!.

Existem vários meios de simplificar o seu sistema, vai depender do quanto vc conhece a linguagem.
Na parte de colisões e no world, poderia usar classe.

Na parte de desenhar e inicializar as imagens poderia usar array:

public static Image[] imagens;
public void init(GameContainer container) throws SlickException {
	tile = new SpriteSheet("res/maptiles.png", 32, 32);
	imagens = new Image[12];

	imagens[1] = grass = tile.getSprite(1, 7);
	imagens[2] = character = tile.getSprite(0, 0);
	imagens[3] = fence = tile.getSprite(4, 7);
	imagens[4] = wallUp = tile.getSprite(0, 7);
	imagens[5] = wallDown = tile.getSprite(6, 7);
	imagens[6] = doorOpen = tile.getSprite(2, 7);
	imagens[7] = doorClosed = tile.getSprite(3, 7);
	imagens[8] = ground = tile.getSprite(7,7);
	imagens[9] = tree = tile.getSprite(5,6);
	imagens[10] = flowers1 = tile.getSprite(8,7);
	imagens[11] = flowers2 = tile.getSprite(9,7);
}

e

g.drawImage(imagens[WorldMap[x][y]], sX+x*tileSize, sY+y*tileSize);

muito obrigado!,
funcionou beleza!, só preciso agora
simplificar a colisao com o world!..
vou fazer umas tentativas!, se tiver alguma ideia me fale!

crie um metodo colide()

public static boolean colide(int x, int y) {
    /* seu codigo */
}

eu sou iniciante na area do java e slick2d…
eu nao sei como fazer direito essa funcao…

eu mudei o modo de como desenha o lugar, estou usando o TileD,
para criar arquivos com extensao .tmx,
consegui dar load do tmx, consegui desenha-lo!, mais
nao faco a minima ideia de como vou fazer colisoes…
pode me ajudar?

public static boolean colide(int x, int y) {
	if(WorldMap[x][y] != 1
			&& WorldMap[x][y] != 6
			&& WorldMap[x][y] != 0
			&& WorldMap[x][y] != 7
			&& WorldMap[x][y] != 8
			&& WorldMap[x][y] != 11
			&& WorldMap[x][y] != 10) {
		return false;
	} else {
		return true;
	}
}

up = colide(dx, dy -1);
left = colide(dx - 1, dy);
down = colide(dx, dy + 1);
right = colide(dx + 1, dy);