I am currently writting a football game called Open Kick-Off
Unfortunately, due to lack of time, activities, work, family and so on, this project had no activities since a long time.
But recently, I decided to restart to work on this project, just because I have some programming interest about AI and java.
Open Kick-Off aims at programming a free, opensource, GPL’ed soccer game similar to the famous Dino Dini’s KickOff 2
And here you can see which result I expect for the scrolling and sprites animation
I am using right now the following principle to display the football ground, and handle scrolling
public class FootballGround extends Panel implements KeyListener, FootballDimensions, Runnable
{
public static Image grassSquareImage;
public static Image BALL_IMG;
public static Image GRASS_IMG;
...
public void paint (Graphics g) { update (g); }
public void update (Graphics g)
{
if (_offGraphics==null)
{
_offImage = createImage (SCREEN_WIDTH, SCREEN_HEIGHT);
_offGraphics = _offImage.getGraphics();
_offGraphics.setColor (Color.black);
}
paintGrass (_offGraphics);
paintLines (_offGraphics);
if (_match.getBall().getHeight()<Player.PLAYER_HEIGHT)
{
paintBall(_offGraphics);
paintPlayers (_offGraphics);
}
else
{
paintPlayers (_offGraphics);
paintBall(_offGraphics);
}
paintScore (_offGraphics);
paintRadar (_offGraphics);
...
/** This function tiles the grass on the screen */
private void paintGrass (Graphics g)
{
Dimension grassDim = new Dimension ( grassSquareImage.getWidth(this), grassSquareImage.getHeight(this));
if(GRASS_IMG==null)
{
Image grassSquareImage = JARImageLoader.loadImage ("grass.gif");
GRASS_IMG = createImage (SCREEN_WIDTH+grassDim.width, SCREEN_HEIGHT+grassDim.height);
Graphics grassGraphics = GRASS_IMG.getGraphics();
for (int x=0; x<SCREEN_WIDTH+grassDim.width; x+=grassDim.width)
{
for (int y=0; y<SCREEN_HEIGHT+grassDim.height; y+=grassDim.height)
{
grassGraphics.drawImage (grassSquareImage, x, y, this);
}
}
}
g.drawImage (GRASS_IMG,
- new Long(Math.round((_camera.getLocation().x+SCREEN_HALF_WIDTH) * PIXELS_PER_METER)).intValue() % grassDim.width,
- new Long(Math.round((_camera.getLocation().y+SCREEN_HALF_HEIGHT) * PIXELS_PER_METER)).intValue() % grassDim.height,
this);
}
but i am not satisfied, I aims to display the orginal pitch
Here are the pitch I want to use for the game which is described as tiles here
So my 1st question is following
According to your experience which would be the best means to achieve the result expected, should I stay on the tiles principle, could you give me inputs, trials or concrete stuff that I can apply
For example how to build the array of tiles that describe the final football ground? Any tools for doing that ?
My 2nd question is for sprites animation
I have the original sprites in this format, what would be the best way to iterate in this image and extract the sprite I want to use.
What would be the best way to do for the sprite animation, should I keep the file like this or extract all sprites in each single file.
Thank for helping and support
Sebastien