From 264371369cd122915edda5216213a7be77b1779a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 5 Dec 2014 23:06:42 +0100 Subject: Pawn,HeadedPawn,StackedImages: add setAlpha(float) --- core/src/ch/asynk/tankontank/engine/HeadedPawn.java | 7 +++++++ core/src/ch/asynk/tankontank/engine/Pawn.java | 6 ++++++ core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java index fb362bc..d237e88 100644 --- a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java +++ b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java @@ -30,6 +30,13 @@ public abstract class HeadedPawn extends Pawn } @Override + public void setAlpha(float alpha) + { + super.setAlpha(alpha); + head.setAlpha(alpha); + } + + @Override public float getRotation() { return orientation.r(); diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 11329b6..66c7122 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -368,6 +368,12 @@ public abstract class Pawn implements Moveable, Disposable return seq; } + public void setAlpha(float alpha) + { + image.setAlpha(alpha); + overlays.setAlpha(alpha); + } + @Override public void draw(Batch batch) { diff --git a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java index a659c68..cb91016 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java @@ -47,6 +47,12 @@ public class StackedImages implements Drawable, Disposable return false; } + public void setAlpha(float alpha) + { + for (int i = 0, n = sprites.size; i < n; i++) + sprites.get(i).setAlpha(alpha); + } + public void rotate(int i, float r) { sprites.get(i).setRotation(r); -- cgit v1.1-2-g2b99