diff --git a/android/assets/cannon_hearth.png b/android/assets/cannon_hearth.png index 9608c70..494efd5 100644 Binary files a/android/assets/cannon_hearth.png and b/android/assets/cannon_hearth.png differ diff --git a/core/src/de/samdev/cannonshooter/entities/CannonBarrel.java b/core/src/de/samdev/cannonshooter/entities/CannonBarrel.java index eef6979..57468f0 100644 --- a/core/src/de/samdev/cannonshooter/entities/CannonBarrel.java +++ b/core/src/de/samdev/cannonshooter/entities/CannonBarrel.java @@ -1,5 +1,9 @@ package de.samdev.cannonshooter.entities; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; + import de.samdev.absgdx.framework.entities.Entity; import de.samdev.absgdx.framework.entities.colliosiondetection.CollisionGeometryOwner; import de.samdev.absgdx.framework.entities.colliosiondetection.geometries.CollisionGeometry; @@ -10,7 +14,6 @@ import de.samdev.cannonshooter.ZLayers; public class CannonBarrel extends Entity { private static final float ANIMATION_DURATION = 1000; - private float rotation = 0; public CannonBarrel(Cannon owner) { @@ -20,7 +23,7 @@ public class CannonBarrel extends Entity { setZLayer(ZLayers.LAYER_CANNON_BARREL); } - + @Override public void onActiveCollide(CollisionGeometryOwner passiveCollider, CollisionGeometry myGeo, CollisionGeometry otherGeo) { // TODO Auto-generated method stub diff --git a/core/src/de/samdev/cannonshooter/entities/CannonHearth.java b/core/src/de/samdev/cannonshooter/entities/CannonHearth.java index 96a6b0e..52d7ef3 100644 --- a/core/src/de/samdev/cannonshooter/entities/CannonHearth.java +++ b/core/src/de/samdev/cannonshooter/entities/CannonHearth.java @@ -1,5 +1,9 @@ package de.samdev.cannonshooter.entities; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; + import de.samdev.absgdx.framework.entities.Entity; import de.samdev.absgdx.framework.entities.colliosiondetection.CollisionGeometryOwner; import de.samdev.absgdx.framework.entities.colliosiondetection.geometries.CollisionGeometry; @@ -8,6 +12,8 @@ import de.samdev.cannonshooter.Textures; import de.samdev.cannonshooter.ZLayers; public class CannonHearth extends Entity { + private static final Color COLOR_NEUTRAL = new Color(0.75f, 0.75f, 0.75f, 1f); + private float rotation = 0; public CannonHearth(Cannon owner) { @@ -18,6 +24,19 @@ public class CannonHearth extends Entity { setZLayer(ZLayers.LAYER_CANNON_HEARTH); } + @Override + public void render(SpriteBatch sbatch, ShapeRenderer srenderer) { + sbatch.setColor(COLOR_NEUTRAL); + + renderTexture(sbatch, Textures.cannon_hearth[63], 0, 0); + + sbatch.setColor(Color.RED); + + renderTexture(sbatch, Textures.cannon_hearth[(int)(rotation/4f) % 64], 0, 0); + + sbatch.setColor(Color.WHITE); + } + @Override public void onActiveCollide(CollisionGeometryOwner passiveCollider, CollisionGeometry myGeo, CollisionGeometry otherGeo) { // TODO Auto-generated method stub @@ -54,12 +73,12 @@ public class CannonHearth extends Entity { @Override public void beforeUpdate(float delta) { - rotation = (rotation + 360 - delta / 8) % 360; + rotation = (rotation + 360 + delta / 8) % 360; } @Override public float getTextureRotation() { - return rotation; + return 0;//rotation; } @Override diff --git a/data/CreateSpriteSheet_Hearth.linq b/data/CreateSpriteSheet_Hearth.linq index 0ebd0c7..a40b140 100644 --- a/data/CreateSpriteSheet_Hearth.linq +++ b/data/CreateSpriteSheet_Hearth.linq @@ -11,8 +11,8 @@ void Main() Image output = new Bitmap(input.Width * 8, input.Height * 8, PixelFormat.Format32bppArgb); - var b1 = new SolidBrush(Color.Black); - var b2 = new SolidBrush(Color.Magenta); + var b1 = new SolidBrush(Color.Transparent); + var b2 = new SolidBrush(Color.White); using (Graphics g = Graphics.FromImage(output)) { @@ -20,7 +20,7 @@ void Main() { for (int y = 0; y < 8; y++) { - var rad = ((y*8 + x) / 64.0) * 2 * Math.PI; + var rad = ((y*8 + x) / 63.0) * 2 * Math.PI; for (int ix = 0; ix < input.Width; ix++) { @@ -31,7 +31,7 @@ void Main() if (input.GetPixel(ix, iy).A > 0) { - if (GetAngle(new Vector2(ix - input.Width / 2f, iy - input.Height / 2f)) < rad) + if (GetAngle(new Vector2(ix - input.Width / 2f, iy - input.Height / 2f)) >= rad) { g.FillRectangle(b1, dx, dy, 1, 1); } diff --git a/lib/absGDX-framework-1.0.jar b/lib/absGDX-framework-1.0.jar index 0128b7c..e4e640e 100644 Binary files a/lib/absGDX-framework-1.0.jar and b/lib/absGDX-framework-1.0.jar differ