moved sprites into single spritesheet + agdtexdef

This commit is contained in:
Mike Schwörer 2015-09-25 14:59:20 +02:00
parent 6bea6a5491
commit bf46dfd1b6
15 changed files with 44 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<texturedefinitions>
<texture identifier="cannon_body" coordinates=" 0,2304 256,256" />
<texture identifier="cannon_bullet" coordinates=" 256,2304 48, 48" />
<texture identifier="level_background" coordinates=" 512,2304 64, 64" />
<flatten_array identifier="cannon_hearth" >
<array_2d coordinates_offset="0,0" identifier="tex_chess_figures" width="256" height="256" size_x="8" size_y="8" />
</flatten_array>
<flatten_array identifier="cannon_barrel" >
<array_2d coordinates_offset="2048,0" identifier="tex_chess_figures" width="512" height="256" size_x="4" size_y="8" />
</flatten_array>
</texturedefinitions>

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View File

@ -5,13 +5,18 @@ import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import de.samdev.absgdx.framework.AgdxGame;
import de.samdev.absgdx.framework.util.exceptions.AgdxTexDefException;
import de.samdev.cannonshooter.level.StandardLevel;
public class CannonGame extends AgdxGame {
@Override
public void onCreate() {
Textures.init();
try {
Textures.init();
} catch (AgdxTexDefException e) {
throw new RuntimeException(e);
}
setLayer(new StandardLevel(this));

View File

@ -1,24 +1,35 @@
package de.samdev.cannonshooter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import de.samdev.absgdx.framework.util.TextureHelper;
import de.samdev.absgdx.framework.menu.texdef.AgdxTextureDefinitionLoader;
import de.samdev.absgdx.framework.util.exceptions.AgdtexdefLoadException;
import de.samdev.absgdx.framework.util.exceptions.AgdtexdefParsingException;
public final class Textures {
public static Texture texbackground;
public static Texture cannon_body;
public static AgdxTextureDefinitionLoader spritesheet;
//#########################################################################
public static TextureRegion level_background;
public static TextureRegion cannon_body;
public static TextureRegion[] cannon_barrel;
public static TextureRegion[] cannon_hearth;
public static Texture cannon_bullet;
public static TextureRegion cannon_bullet;
public static void init() {
texbackground = new Texture("level_background.png");
public static void init() throws AgdtexdefParsingException, AgdtexdefLoadException {
spritesheet = new AgdxTextureDefinitionLoader(Gdx.files.internal("spritesheet.agdtexdef"), new Texture("spritesheet.png"));
spritesheet.parse();
cannon_body = new Texture("cannon_body.png");
cannon_barrel = TextureHelper.load1DArray("cannon_barrel.png", 512, 256, 32);
cannon_hearth = TextureHelper.load1DArray("cannon_hearth.png", 256, 256, 64);
cannon_bullet = new Texture("cannon_bullet.png");
level_background = spritesheet.getSingleTexture("level_background");
cannon_body = spritesheet.getSingleTexture("cannon_body");
cannon_barrel = spritesheet.getTextureArray("cannon_barrel");
cannon_hearth = spritesheet.getTextureArray("cannon_hearth");
cannon_bullet = spritesheet.getSingleTexture("cannon_bullet");
}
}

View File

@ -32,11 +32,11 @@ public class StandardLevel extends GameLayer {
initMap();
setTimeMultiplier(3);
//setTimeMultiplier(3);
}
private void initMap() {
addBackground(new RepeatingBackground(Textures.texbackground, 1/32f));
addBackground(new RepeatingBackground(Textures.level_background, 1/32f));
setMapScaleResolver(new ShowCompleteMapScaleResolver());
addEntity(new Cannon(6, 25, team_player));

BIN
data/border_gradient.pdn Normal file

Binary file not shown.

Binary file not shown.

BIN
data/spritesheet.pdn Normal file

Binary file not shown.

Binary file not shown.