diff options
Diffstat (limited to 'src/ch/epfl')
-rw-r--r-- | src/ch/epfl/xblast/server/painter/PlayerPainter.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ch/epfl/xblast/server/painter/PlayerPainter.java b/src/ch/epfl/xblast/server/painter/PlayerPainter.java index a366918..79b954c 100644 --- a/src/ch/epfl/xblast/server/painter/PlayerPainter.java +++ b/src/ch/epfl/xblast/server/painter/PlayerPainter.java | |||
@@ -16,6 +16,8 @@ public final class PlayerPainter { | |||
16 | private static final byte DYING_IMAGE_ID = 12; | 16 | private static final byte DYING_IMAGE_ID = 12; |
17 | private static final byte LAST_DYING_IMAGE_ID = 13; | 17 | private static final byte LAST_DYING_IMAGE_ID = 13; |
18 | 18 | ||
19 | private static final int BLANK_PLAYER_GROUP = 4; | ||
20 | |||
19 | private static final int PLAYER_MULTIPLIER = 20; | 21 | private static final int PLAYER_MULTIPLIER = 20; |
20 | private static final int DIRECTION_MULTIPLIER = 3; | 22 | private static final int DIRECTION_MULTIPLIER = 3; |
21 | 23 | ||
@@ -53,6 +55,15 @@ public final class PlayerPainter { | |||
53 | } | 55 | } |
54 | 56 | ||
55 | /** | 57 | /** |
58 | * Returns the player image byte for the blank player. | ||
59 | * | ||
60 | * @return the image byte for the player | ||
61 | */ | ||
62 | private static byte byteForPlayerID() { | ||
63 | return (byte) (BLANK_PLAYER_GROUP * PLAYER_MULTIPLIER); | ||
64 | } | ||
65 | |||
66 | /** | ||
56 | * Returns the image ID for the dying state according to the number of remaining lives. | 67 | * Returns the image ID for the dying state according to the number of remaining lives. |
57 | * | 68 | * |
58 | * @param lives the number of remaining lives | 69 | * @param lives the number of remaining lives |
@@ -78,6 +89,12 @@ public final class PlayerPainter { | |||
78 | return (byte) (byteForPlayerID(player.id()) | 89 | return (byte) (byteForPlayerID(player.id()) |
79 | + byteForDyingState(player.lives())); | 90 | + byteForDyingState(player.lives())); |
80 | 91 | ||
92 | case INVULNERABLE: | ||
93 | if (tick % 2 == 1) | ||
94 | return (byte) (byteForPlayerID() | ||
95 | + byteForDirection(player.direction()) | ||
96 | + byteForFrame(tick)); | ||
97 | |||
81 | default: | 98 | default: |
82 | return (byte) (byteForPlayerID(player.id()) | 99 | return (byte) (byteForPlayerID(player.id()) |
83 | + byteForDirection(player.direction()) | 100 | + byteForDirection(player.direction()) |