diff --git a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/mechanics/TimeLimitedGameEngine.java b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/mechanics/TimeLimitedGameEngine.java
index 85f1f2f2..68b64cd7 100644
--- a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/mechanics/TimeLimitedGameEngine.java
+++ b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/mechanics/TimeLimitedGameEngine.java
@@ -19,17 +19,19 @@ protected void onKill() {
public void spawn() {
super.spawn();
if (mGameInformation.getCurrentTargetsNumber() < mGameInformation.getMaxTargetOnTheField()) {
- final int randomDraw = MathUtils.randomize(0,100);
+ final int randomDraw = MathUtils.randomize(0, 100);
final float[] pos = mGameInformation.getCurrentPosition();
int ghostType;
- if(randomDraw < 60) {
+ if (randomDraw < 60) {
ghostType = DisplayableItemFactory.TYPE_EASY_GHOST;
- }else if (randomDraw < 75){
+ } else if (randomDraw < 75) {
ghostType = DisplayableItemFactory.TYPE_HIDDEN_GHOST;
- }else if (randomDraw < 90){
+ } else if (randomDraw < 90) {
ghostType = DisplayableItemFactory.TYPE_BABY_GHOST;
- } else {
+ } else if (randomDraw < 99) {
ghostType = DisplayableItemFactory.TYPE_GHOST_WITH_HELMET;
+ } else {
+ ghostType = DisplayableItemFactory.TYPE_KING_GHOST;
}
mGameInformation.addTargetableItem(DisplayableItemFactory.createGhostWithRandomCoordinates(
ghostType,
diff --git a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/model/BestiaryEntryFactory.java b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/model/BestiaryEntryFactory.java
index b06584ee..9a84f6e1 100644
--- a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/model/BestiaryEntryFactory.java
+++ b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/model/BestiaryEntryFactory.java
@@ -19,12 +19,18 @@ public static BestiaryEntry createBestiaryEntry(int ghostType) {
bestiaryEntry.setTitleResourceId(R.string.bestiary_baby_ghost_title);
break;
- case DisplayableItemFactory.TYPE_HIDDEN_GHOST:
+ case DisplayableItemFactory.TYPE_HIDDEN_GHOST:
bestiaryEntry.setTargetableItem(DisplayableItemFactory.createHiddenGhost());
bestiaryEntry.setImageResourceId(R.drawable.hidden_ghost);
bestiaryEntry.setTitleResourceId(R.string.bestiary_hidden_ghost_title);
break;
+ case DisplayableItemFactory.TYPE_KING_GHOST:
+ bestiaryEntry.setTargetableItem(DisplayableItemFactory.createKingGhost());
+ bestiaryEntry.setImageResourceId(R.drawable.king_ghost);
+ bestiaryEntry.setTitleResourceId(R.string.bestiary_king_ghost_title);
+ break;
+
default:
bestiaryEntry.setTargetableItem(DisplayableItemFactory.createEasyGhost());
bestiaryEntry.setImageResourceId(R.drawable.ghost);
diff --git a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/model/DisplayableItemFactory.java b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/model/DisplayableItemFactory.java
index cba8092f..891382f1 100644
--- a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/model/DisplayableItemFactory.java
+++ b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/model/DisplayableItemFactory.java
@@ -7,6 +7,7 @@ public class DisplayableItemFactory {
public final static int TYPE_BABY_GHOST = 0x00000003;
public final static int TYPE_GHOST_WITH_HELMET = 0x00000004;
public final static int TYPE_HIDDEN_GHOST = 0x00000005;
+ public final static int TYPE_KING_GHOST = 0x00000006;
private static final int DEFAULT_X_MIN_IN_DEGREE = -170;
private static final int DEFAULT_X_MAX_IN_DEGREE = 170;
@@ -18,18 +19,21 @@ public class DisplayableItemFactory {
public final static int HEALTH_BABY_GHOST = 1;
public final static int HEALTH_GHOST_WITH_HELMET = 5;
public final static int HEALTH_HIDDEN_GHOST = 1;
+ public final static int HEALTH_KING_GHOST = 1;
//Base Point
public final static int BASE_POINT_EAST_GHOST = 1;
public final static int BASE_POINT_BABY_GHOST = 2;
public final static int BASE_POINT_GHOST_WITH_HELMET = 10;
public final static int BASE_POINT_HIDDEN_GHOST = 2;
+ public final static int BASE_POINT_KING_GHOST = 0;
//Exp Point
public final static int EXP_POINT_EASY_GHOST = 2;
public final static int EXP_POINT_BABY_GHOST = 4;
public final static int EXP_POINT_GHOST_WITH_HELMET = 10;
public final static int EXP_POINT_HIDDEN_GHOST = 5;
+ public final static int EXP_POINT_KING_GHOST = 0;
public static TargetableItem createGhostWithRandomCoordinates(int ghostType) {
@@ -52,8 +56,11 @@ public static TargetableItem createGhostWithRandomCoordinates(int ghostType, int
case TYPE_HIDDEN_GHOST:
targetableItem = createHiddenGhost();
break;
- }
+ case TYPE_KING_GHOST:
+ targetableItem = createKingGhost();
+ break;
+ }
targetableItem.setRandomCoordinates(xMin, xMax, yMin, yMax);
return targetableItem;
}
@@ -87,6 +94,13 @@ public static TargetableItem createHiddenGhost() {
EXP_POINT_HIDDEN_GHOST);
}
+ public static TargetableItem createKingGhost() {
+ return createTargetableItem(TYPE_KING_GHOST,
+ HEALTH_KING_GHOST,
+ BASE_POINT_KING_GHOST,
+ EXP_POINT_KING_GHOST);
+ }
+
private static TargetableItem createTargetableItem(int type, int health, int basePoint, int expPoint) {
TargetableItem targetableItem = new TargetableItem();
diff --git a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/ui/GameView.java b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/ui/GameView.java
index b76fccc4..6e01b466 100644
--- a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/ui/GameView.java
+++ b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/ui/GameView.java
@@ -28,6 +28,8 @@ public class GameView extends View {
private final Bitmap mTargetedBabyGhostBitmap;
private final Bitmap[] mGhostWithHelmetBitmaps;
private final Bitmap[] mGhostWithHelmetTargetedBitmaps;
+ private final Bitmap mKingGhost;
+ private final Bitmap mTargetedKingGhost;
private final Bitmap mHiddenGhost;
private final String mComboString;
private final String mScoreString;
@@ -76,6 +78,8 @@ public GameView(Context context, GameInformation model) {
};
mHiddenGhost = BitmapFactory.decodeResource(res, R.drawable.hidden_ghost);
+ mKingGhost = BitmapFactory.decodeResource(res, R.drawable.king_ghost);
+ mTargetedKingGhost = BitmapFactory.decodeResource(res, R.drawable.targeted_king_ghost);
mComboString = res.getString(R.string.in_game_combo_counter);
mScoreString = res.getString(R.string.in_game_score);
@@ -234,6 +238,9 @@ private void drawDisplayableItems(Canvas canvas) {
case DisplayableItemFactory.TYPE_HIDDEN_GHOST:
renderHiddenGhost(canvas, (TargetableItem) i, currentPos);
break;
+ case DisplayableItemFactory.TYPE_KING_GHOST:
+ renderKingGhost(canvas, (TargetableItem) i, currentPos);
+ break;
case DisplayableItemFactory.TYPE_BULLET_HOLE:
renderBulletHole(canvas, i);
break;
@@ -277,6 +284,10 @@ private void renderHiddenGhost(Canvas canvas, TargetableItem hiddenGhost, float[
renderGhost(canvas, hiddenGhost, currentPos, mHiddenGhost, mGhostTargetedBitmap);
}
+ private void renderKingGhost(Canvas canvas, TargetableItem kingGhost, float[] currentPos) {
+ renderGhost(canvas, kingGhost, currentPos, mKingGhost, mTargetedKingGhost);
+ }
+
private void renderGhost(Canvas canvas, TargetableItem ghost, float[] currentPos, Bitmap ghostBitmap, Bitmap targetedGhostBitmap) {
if (!ghost.isAlive()) {
//Ghost dead
@@ -369,6 +380,9 @@ public void animateDyingGhost(TargetableItem ghost) {
case DisplayableItemFactory.TYPE_GHOST_WITH_HELMET:
bitmap = mGhostWithHelmetTargetedBitmaps[4];
break;
+ case DisplayableItemFactory.TYPE_KING_GHOST:
+ bitmap = mTargetedKingGhost;
+ break;
default:
bitmap = mGhostTargetedBitmap;
break;
diff --git a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/ui/fragments/BestiaryFragment.java b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/ui/fragments/BestiaryFragment.java
index fa8d5db7..93f7e35b 100644
--- a/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/ui/fragments/BestiaryFragment.java
+++ b/ChaseWhisply/src/main/java/fr/tvbarthel/games/chasewhisply/ui/fragments/BestiaryFragment.java
@@ -9,9 +9,9 @@
import fr.tvbarthel.games.chasewhisply.R;
import fr.tvbarthel.games.chasewhisply.model.BestiaryEntry;
-import fr.tvbarthel.games.chasewhisply.ui.BestiaryEntryAdapter;
import fr.tvbarthel.games.chasewhisply.model.BestiaryEntryFactory;
import fr.tvbarthel.games.chasewhisply.model.DisplayableItemFactory;
+import fr.tvbarthel.games.chasewhisply.ui.BestiaryEntryAdapter;
public class BestiaryFragment extends Fragment {
private ListView mBestiaryListView;
@@ -30,7 +30,8 @@ public void onActivityCreated(Bundle savedInstanceState) {
BestiaryEntryFactory.createBestiaryEntry(DisplayableItemFactory.TYPE_EASY_GHOST),
BestiaryEntryFactory.createBestiaryEntry(DisplayableItemFactory.TYPE_BABY_GHOST),
BestiaryEntryFactory.createBestiaryEntry(DisplayableItemFactory.TYPE_GHOST_WITH_HELMET),
- BestiaryEntryFactory.createBestiaryEntry(DisplayableItemFactory.TYPE_HIDDEN_GHOST)
+ BestiaryEntryFactory.createBestiaryEntry(DisplayableItemFactory.TYPE_HIDDEN_GHOST),
+ BestiaryEntryFactory.createBestiaryEntry(DisplayableItemFactory.TYPE_KING_GHOST)
}));
}
}
diff --git a/ChaseWhisply/src/main/res/drawable-hdpi/king_ghost.png b/ChaseWhisply/src/main/res/drawable-hdpi/king_ghost.png
new file mode 100644
index 00000000..a05c1086
Binary files /dev/null and b/ChaseWhisply/src/main/res/drawable-hdpi/king_ghost.png differ
diff --git a/ChaseWhisply/src/main/res/drawable-hdpi/targeted_king_ghost.png b/ChaseWhisply/src/main/res/drawable-hdpi/targeted_king_ghost.png
new file mode 100644
index 00000000..7aa3bfed
Binary files /dev/null and b/ChaseWhisply/src/main/res/drawable-hdpi/targeted_king_ghost.png differ
diff --git a/ChaseWhisply/src/main/res/drawable-mdpi/king_ghost.png b/ChaseWhisply/src/main/res/drawable-mdpi/king_ghost.png
new file mode 100644
index 00000000..a72fb787
Binary files /dev/null and b/ChaseWhisply/src/main/res/drawable-mdpi/king_ghost.png differ
diff --git a/ChaseWhisply/src/main/res/drawable-mdpi/targeted_king_ghost.png b/ChaseWhisply/src/main/res/drawable-mdpi/targeted_king_ghost.png
new file mode 100644
index 00000000..c62979af
Binary files /dev/null and b/ChaseWhisply/src/main/res/drawable-mdpi/targeted_king_ghost.png differ
diff --git a/ChaseWhisply/src/main/res/drawable-xhdpi/king_ghost.png b/ChaseWhisply/src/main/res/drawable-xhdpi/king_ghost.png
new file mode 100644
index 00000000..2e3722e3
Binary files /dev/null and b/ChaseWhisply/src/main/res/drawable-xhdpi/king_ghost.png differ
diff --git a/ChaseWhisply/src/main/res/drawable-xhdpi/targeted_king_ghost.png b/ChaseWhisply/src/main/res/drawable-xhdpi/targeted_king_ghost.png
new file mode 100644
index 00000000..3dc266a3
Binary files /dev/null and b/ChaseWhisply/src/main/res/drawable-xhdpi/targeted_king_ghost.png differ
diff --git a/ChaseWhisply/src/main/res/drawable-xxhdpi/king_ghost.png b/ChaseWhisply/src/main/res/drawable-xxhdpi/king_ghost.png
new file mode 100644
index 00000000..be4b0571
Binary files /dev/null and b/ChaseWhisply/src/main/res/drawable-xxhdpi/king_ghost.png differ
diff --git a/ChaseWhisply/src/main/res/drawable-xxhdpi/targeted_king_ghost.png b/ChaseWhisply/src/main/res/drawable-xxhdpi/targeted_king_ghost.png
new file mode 100644
index 00000000..19cdbad3
Binary files /dev/null and b/ChaseWhisply/src/main/res/drawable-xxhdpi/targeted_king_ghost.png differ
diff --git a/ChaseWhisply/src/main/res/values-fr/strings.xml b/ChaseWhisply/src/main/res/values-fr/strings.xml
index 7ca60b87..89e7f891 100644
--- a/ChaseWhisply/src/main/res/values-fr/strings.xml
+++ b/ChaseWhisply/src/main/res/values-fr/strings.xml
@@ -186,4 +186,5 @@
Fantôme Renforcé
Bébé Fantôme
Fantôme Caché
+ Roi des Fantômes
\ No newline at end of file
diff --git a/ChaseWhisply/src/main/res/values/strings.xml b/ChaseWhisply/src/main/res/values/strings.xml
index b67f6129..8e497a51 100644
--- a/ChaseWhisply/src/main/res/values/strings.xml
+++ b/ChaseWhisply/src/main/res/values/strings.xml
@@ -180,5 +180,6 @@
Reinforced Ghost
Baby Ghost
Hidden Ghost
+ King of Ghosts