From c44550bd30a154f9614178b6de01b3a15a3f93f1 Mon Sep 17 00:00:00 2001 From: Timothée Floure Date: Wed, 24 Feb 2016 15:55:07 +0100 Subject: Add the Block enum and the Ticks interface --- src/ch/epfl/xblast/server/Block.java | 51 ++++++++++++++++++++++++++++++++++++ src/ch/epfl/xblast/server/Ticks.java | 33 +++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 src/ch/epfl/xblast/server/Block.java create mode 100644 src/ch/epfl/xblast/server/Ticks.java (limited to 'src/ch') 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 @@ +package ch.epfl.xblast.server; + +public enum Block { + + /** + * 'Free' block, no wall. + */ + FREE, + + /** + * Indestructible block. + */ + INDESTRUCTIBLE_WALL, + + /** + * Destructible block. + */ + DESTRUCTIBLE_WALL, + + /** + * Crumbling Wall. + */ + CRUMBLING_WALL; + + /** + * Returns T(this block is free). + * + * @return T(this block is free) + */ + public boolean isFree() { + return this == FREE; + } + + /** + * Returns T(this block can host a player). + * + * @return T(this block can host a player) + */ + public boolean canHostPlayer() { + return this.isFree(); + } + + /** + * Returns T(this block cast a shadow) + * + * @returns T(this block cast a shadow) + */ + public boolean castsSahdow() { + return this == INDESTRUCTIBLE_WALL || this == DESTRUCTILE_WALL || this == CRUMBLING_WALL; + } +} 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 @@ +package ch.epfl.xblast.server; + +public interface Ticks { + /** + * Duration of the death of a player. + */ + public static int PLAYER_DYING_TICKS = 8; + + /** + * Duration of the invulnerability of a player. + */ + public static int PLAYER_INVULNERABLE_TICKS = 64; + + /** + * Duration of + */ + public static int BOMB_FUSE_TICKS = 100; + + /** + * Duration of an explosion. + */ + public static int EXPLOSION_TICKS = 30; + + /** + * Duration of crumbling of a wall. + */ + public static int WALL_CRUMBLLING_TICKS = EXPLOSION_TICKS; + + /** + * Duration of the presence of a bonus. + */ + public static int BONUS_DISAPPEARING_TICKS = EXPLOSION_TICKS; +} -- cgit v1.2.3