diff --git a/android/assets/barrel.png b/android/assets/barrel.png new file mode 100644 index 0000000..38ba2ff Binary files /dev/null and b/android/assets/barrel.png differ diff --git a/android/assets/cannon.png b/android/assets/cannon.png index c5a6640..dd62d0d 100644 Binary files a/android/assets/cannon.png and b/android/assets/cannon.png differ diff --git a/android/assets/cannon_barrel.png b/android/assets/cannon_barrel.png new file mode 100644 index 0000000..44a2298 Binary files /dev/null and b/android/assets/cannon_barrel.png differ diff --git a/android/assets/cannon_body.png b/android/assets/cannon_body.png new file mode 100644 index 0000000..559a3bb Binary files /dev/null and b/android/assets/cannon_body.png differ diff --git a/android/assets/level_background.png b/android/assets/level_background.png index 0a5f68e..062a0f8 100644 Binary files a/android/assets/level_background.png and b/android/assets/level_background.png differ diff --git a/core/src/de/samdev/cannonshooter/CannonGame.java b/core/src/de/samdev/cannonshooter/CannonGame.java index 722e527..218bdc6 100644 --- a/core/src/de/samdev/cannonshooter/CannonGame.java +++ b/core/src/de/samdev/cannonshooter/CannonGame.java @@ -18,7 +18,8 @@ public class CannonGame extends AgdxGame { setDebugFont(new BitmapFont(Gdx.files.internal("consolefont.fnt"))); settings.debugVisualMenu.set(false); - settings.debugMenuLayerTextInfos.set(false); + settings.debugMenuLayerTextInfos.set(true); + settings.debugGameLayerMenuTextInfos.set(false); settings.debugEnabled.set(true); } diff --git a/core/src/de/samdev/cannonshooter/Textures.java b/core/src/de/samdev/cannonshooter/Textures.java index 86cc784..3c67ada 100644 --- a/core/src/de/samdev/cannonshooter/Textures.java +++ b/core/src/de/samdev/cannonshooter/Textures.java @@ -4,10 +4,16 @@ import com.badlogic.gdx.graphics.Texture; public final class Textures { public static Texture texbackground; - public static Texture cannon; + + public static Texture cannon_body; + public static Texture cannon_barrel; + public static Texture cannon_hearth; + public static Texture cannon_bullet; public static void init() { texbackground = new Texture("level_background.png"); - cannon = new Texture("cannon.png"); + + cannon_body = new Texture("cannon_body.png"); + cannon_barrel = new Texture("cannon_barrel.png"); } } diff --git a/core/src/de/samdev/cannonshooter/ZLayers.java b/core/src/de/samdev/cannonshooter/ZLayers.java new file mode 100644 index 0000000..949577c --- /dev/null +++ b/core/src/de/samdev/cannonshooter/ZLayers.java @@ -0,0 +1,12 @@ +package de.samdev.cannonshooter; + +public final class ZLayers { + + // Higher Number => in front + + public final static int LAYER_CANNON_BULLET = 4; + public final static int LAYER_CANNON_HEARTH = 3; + public final static int LAYER_CANNON_BODY = 2; + public final static int LAYER_CANNON_BARREL = 1; + +} diff --git a/core/src/de/samdev/cannonshooter/entities/Cannon.java b/core/src/de/samdev/cannonshooter/entities/Cannon.java index 84f51d5..fb45192 100644 --- a/core/src/de/samdev/cannonshooter/entities/Cannon.java +++ b/core/src/de/samdev/cannonshooter/entities/Cannon.java @@ -5,13 +5,25 @@ import de.samdev.absgdx.framework.entities.colliosiondetection.CollisionGeometry import de.samdev.absgdx.framework.entities.colliosiondetection.geometries.CollisionGeometry; import de.samdev.absgdx.framework.layer.GameLayer; import de.samdev.cannonshooter.Textures; +import de.samdev.cannonshooter.ZLayers; public class Cannon extends Entity { + private CannonBarrel barrel; + public Cannon(float x, float y) { - super(Textures.cannon, 1, 1); + super(Textures.cannon_body, 2, 2); setPosition(x, y); + + setZLayer(ZLayers.LAYER_CANNON_BODY); + } + + @Override + public void onLayerAdd(GameLayer layer) { + barrel = new CannonBarrel(this); + + layer.addEntity(barrel); } @Override @@ -54,10 +66,4 @@ public class Cannon extends Entity { } - @Override - public void onLayerAdd(GameLayer layer) { - // TODO Auto-generated method stub - - } - } diff --git a/core/src/de/samdev/cannonshooter/entities/CannonBarrel.java b/core/src/de/samdev/cannonshooter/entities/CannonBarrel.java new file mode 100644 index 0000000..446575b --- /dev/null +++ b/core/src/de/samdev/cannonshooter/entities/CannonBarrel.java @@ -0,0 +1,73 @@ +package de.samdev.cannonshooter.entities; + +import de.samdev.absgdx.framework.entities.Entity; +import de.samdev.absgdx.framework.entities.colliosiondetection.CollisionGeometryOwner; +import de.samdev.absgdx.framework.entities.colliosiondetection.geometries.CollisionGeometry; +import de.samdev.absgdx.framework.layer.GameLayer; +import de.samdev.cannonshooter.Textures; +import de.samdev.cannonshooter.ZLayers; + +public class CannonBarrel extends Entity { + + private float rotation = 0; + + public CannonBarrel(Cannon owner) { + super(Textures.cannon_barrel, 4, 2); + + setPosition(owner.getPositionX() - 1, owner.getPositionY()); + + setZLayer(ZLayers.LAYER_CANNON_BARREL); + } + + @Override + public void onActiveCollide(CollisionGeometryOwner passiveCollider, CollisionGeometry myGeo, CollisionGeometry otherGeo) { + // TODO Auto-generated method stub + + } + + @Override + public void onPassiveCollide(CollisionGeometryOwner activeCollider, CollisionGeometry myGeo, CollisionGeometry otherGeo) { + // TODO Auto-generated method stub + + } + + @Override + public void onActiveMovementCollide(CollisionGeometryOwner passiveCollider, CollisionGeometry myGeo, CollisionGeometry otherGeo) { + // TODO Auto-generated method stub + + } + + @Override + public void onPassiveMovementCollide(CollisionGeometryOwner activeCollider, CollisionGeometry myGeo, CollisionGeometry otherGeo) { + // TODO Auto-generated method stub + + } + + @Override + public boolean canCollideWith(CollisionGeometryOwner other) { + return false; + } + + @Override + public boolean canMoveCollideWith(CollisionGeometryOwner other) { + return false; + } + + @Override + public void beforeUpdate(float delta) { + rotation += 1; + rotation = (rotation + 1) % 360; + } + + @Override + public float getTextureRotation() { + return rotation; + } + + @Override + public void onLayerAdd(GameLayer layer) { + // TODO Auto-generated method stub + + } + +} diff --git a/core/src/de/samdev/cannonshooter/level/StandardLevel.java b/core/src/de/samdev/cannonshooter/level/StandardLevel.java index b5b1905..56dcd00 100644 --- a/core/src/de/samdev/cannonshooter/level/StandardLevel.java +++ b/core/src/de/samdev/cannonshooter/level/StandardLevel.java @@ -1,7 +1,5 @@ package de.samdev.cannonshooter.level; -import java.util.Random; - import com.badlogic.gdx.math.Vector2; import de.samdev.absgdx.framework.AgdxGame; @@ -15,30 +13,25 @@ import de.samdev.cannonshooter.framework.TileAlignedBackground; public class StandardLevel extends GameLayer { public StandardLevel(AgdxGame owner) { - super(owner, TileMap.createEmptyMap(32, 32)); + super(owner, TileMap.createEmptyMap(32, 20)); addBackground(new TileAlignedBackground(Textures.texbackground, 1)); setMapScaleResolver(new ShowCompleteMapScaleResolver()); - setRawOffset(new Vector2(-(getVisibleMapBox().width - getMap().width)/2, -(getVisibleMapBox().height - getMap().height)/2)); - - - Random R = new Random(80085); - for (int i = 0; i < 24; i++) { - addEntity(new Cannon(R.nextInt(15)*2+1, R.nextInt(15)*2+1)); - } + + addEntity(new Cannon(10, 10)); } @Override public void onResize() { super.onResize(); + // Center Map setRawOffset(new Vector2(-(getVisibleMapBox().width - getMap().width)/2, -(getVisibleMapBox().height - getMap().height)/2)); } @Override public void onUpdate(float arg0) { - //setRawOffset(new Vector2(-(getVisibleMapBox().width - getMap().width)/2, -(getVisibleMapBox().height - getMap().height)/2)); + // } - } diff --git a/data/cannon_sketch.pdn b/data/cannon_sketch.pdn new file mode 100644 index 0000000..3bf5f54 Binary files /dev/null and b/data/cannon_sketch.pdn differ diff --git a/lib/absGDX-framework-1.0.jar b/lib/absGDX-framework-1.0.jar index d560f4b..d30d741 100644 Binary files a/lib/absGDX-framework-1.0.jar and b/lib/absGDX-framework-1.0.jar differ