public void renderEntity(int xp, int yp, Sprite sprite, boolean xFlip, boolean yFlip){
		xp -= xOffset;
		yp -= yOffset;

		for (int y = 0; y < sprite.SIZE; y++){
			int ys = y;
			int ya =  y + yp; 
			if (yFlip) ys = (sprite.SIZE - 1) - y;
			
			for (int x = 0; x < sprite.SIZE; x++){
				int xs = x;
				int xa =  x + xp; 
				if (xFlip) xs = (sprite.SIZE - 1) - x;
				
				if(xa < - sprite.SIZE || xa >= width  || ya < 0 || ya >= height) break;
				if (xa < 0 ) xa = 0; 
				
				int color = sprite.pixels[xs + ys * sprite.SIZE];
				if(color != 0xffff00ff) pixels[xa + ya * width] = color;
			}
		}
		
	}