diff options
author | Timothée Floure | 2016-02-24 15:55:07 +0100 |
---|---|---|
committer | Timothée Floure | 2016-02-24 15:55:07 +0100 |
commit | c44550bd30a154f9614178b6de01b3a15a3f93f1 (patch) | |
tree | dcd7dc4515b5ab14b72100c1071066b18c603478 /src/ch | |
parent | 45880b06c053e75e1778a598245015c65440a5bc (diff) | |
download | xblast-c44550bd30a154f9614178b6de01b3a15a3f93f1.tar.gz |
Add the Block enum and the Ticks interface
Diffstat (limited to 'src/ch')
-rw-r--r-- | src/ch/epfl/xblast/server/Block.java | 51 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/Ticks.java | 33 |
2 files changed, 84 insertions, 0 deletions
diff --git a/src/ch/epfl/xblast/server/Block.java b/src/ch/epfl/xblast/server/Block.java new file mode 100644 index 0000000..75925a3 --- /dev/null +++ b/src/ch/epfl/xblast/server/Block.java | |||
@@ -0,0 +1,51 @@ | |||
1 | package ch.epfl.xblast.server; | ||
2 | |||
3 | public enum Block { | ||
4 | |||
5 | /** | ||
6 | * 'Free' block, no wall. | ||
7 | */ | ||
8 | FREE, | ||
9 | |||
10 | /** | ||
11 | * Indestructible block. | ||
12 | */ | ||
13 | INDESTRUCTIBLE_WALL, | ||
14 | |||
15 | /** | ||
16 | * Destructible block. | ||
17 | */ | ||
18 | DESTRUCTIBLE_WALL, | ||
19 | |||
20 | /** | ||
21 | * Crumbling Wall. | ||
22 | */ | ||
23 | CRUMBLING_WALL; | ||
24 | |||
25 | /** | ||
26 | * Returns T(this block is free). | ||
27 | * | ||
28 | * @return T(this block is free) | ||
29 | */ | ||
30 | public boolean isFree() { | ||
31 | return this == FREE; | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * Returns T(this block can host a player). | ||
36 | * | ||
37 | * @return T(this block can host a player) | ||
38 | */ | ||
39 | public boolean canHostPlayer() { | ||
40 | return this.isFree(); | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Returns T(this block cast a shadow) | ||
45 | * | ||
46 | * @returns T(this block cast a shadow) | ||
47 | */ | ||
48 | public boolean castsSahdow() { | ||
49 | return this == INDESTRUCTIBLE_WALL || this == DESTRUCTILE_WALL || this == CRUMBLING_WALL; | ||
50 | } | ||
51 | } | ||
diff --git a/src/ch/epfl/xblast/server/Ticks.java b/src/ch/epfl/xblast/server/Ticks.java new file mode 100644 index 0000000..8c1e134 --- /dev/null +++ b/src/ch/epfl/xblast/server/Ticks.java | |||
@@ -0,0 +1,33 @@ | |||
1 | package ch.epfl.xblast.server; | ||
2 | |||
3 | public interface Ticks { | ||
4 | /** | ||
5 | * Duration of the death of a player. | ||
6 | */ | ||
7 | public static int PLAYER_DYING_TICKS = 8; | ||
8 | |||
9 | /** | ||
10 | * Duration of the invulnerability of a player. | ||
11 | */ | ||
12 | public static int PLAYER_INVULNERABLE_TICKS = 64; | ||
13 | |||
14 | /** | ||
15 | * Duration of | ||
16 | */ | ||
17 | public static int BOMB_FUSE_TICKS = 100; | ||
18 | |||
19 | /** | ||
20 | * Duration of an explosion. | ||
21 | */ | ||
22 | public static int EXPLOSION_TICKS = 30; | ||
23 | |||
24 | /** | ||
25 | * Duration of crumbling of a wall. | ||
26 | */ | ||
27 | public static int WALL_CRUMBLLING_TICKS = EXPLOSION_TICKS; | ||
28 | |||
29 | /** | ||
30 | * Duration of the presence of a bonus. | ||
31 | */ | ||
32 | public static int BONUS_DISAPPEARING_TICKS = EXPLOSION_TICKS; | ||
33 | } | ||