Animated Barrel

This commit is contained in:
2015-09-17 14:37:44 +02:00
parent 3be4b2cab2
commit f1cd7f4099
8 changed files with 40 additions and 5 deletions

View File

@@ -1,12 +1,15 @@
package de.samdev.cannonshooter;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import de.samdev.absgdx.framework.util.TextureHelper;
public final class Textures {
public static Texture texbackground;
public static Texture cannon_body;
public static Texture cannon_barrel;
public static TextureRegion[] cannon_barrel;
public static Texture cannon_hearth;
public static Texture cannon_bullet;
@@ -14,6 +17,6 @@ public final class Textures {
texbackground = new Texture("level_background.png");
cannon_body = new Texture("cannon_body.png");
cannon_barrel = new Texture("cannon_barrel.png");
cannon_barrel = TextureHelper.load1DArray("cannon_barrel.png", 512, 256, 16);
}
}

View File

@@ -8,11 +8,13 @@ import de.samdev.cannonshooter.Textures;
import de.samdev.cannonshooter.ZLayers;
public class CannonBarrel extends Entity {
private static final float ANIMATION_DURATION = 2000;
private float rotation = 0;
public CannonBarrel(Cannon owner) {
super(Textures.cannon_barrel, 4, 2);
super(Textures.cannon_barrel, ANIMATION_DURATION, 4, 2);
setPosition(owner.getPositionX() - 1, owner.getPositionY());
@@ -61,7 +63,7 @@ public class CannonBarrel extends Entity {
@Override
public float getTextureRotation() {
return rotation;
return 0;
}
@Override