fr.enssat.BoulderDash.models

## Class DisplayableElementModel

- java.lang.Object
- - fr.enssat.BoulderDash.models.DisplayableElementModel

Direct Known Subclasses:
  BoulderModel, BrickWallModel, CursorModel, DiamondModel, DirtModel, DoorModel, EmptyModel, ExpandingWallModel, MagicWallModel, RockfordModel, SteelWallModel

    public abstract class DisplayableElementModel
    extends java.lang.Object

DisplayableElementModel Represents a abstract displayable element

Since:
  2015-06-19
Author:
  Colin Leverger <me@colinleverger.fr>

### Constructor Summary

Constructors
Constructor and Description
`DisplayableElementModel(boolean destructible, boolean moving, java.lang.String spriteName, int priority, boolean impactExplosive, boolean animate, boolean falling, java.lang.String collideSound)`
`DisplayableElementModel(boolean destructible, boolean moving, java.lang.String spriteName, int priority, boolean impactExplosive, boolean animate, boolean falling, java.lang.String collideSound, boolean convertible)` Class constructor

### Method Summary

Methods
`java.lang.String` `getCollideSound()` Gets the collide sound of the object
`java.lang.String` `getGroupName()` Gets the group name value
`java.lang.String` `getPathToSprite()` Gets the path to the sprite file in storage
`int` `getPriority()` Gets the priority of the object
`java.awt.image.BufferedImage` `getSprite()` Gets the sprite
`java.lang.String` `getSpriteName()` Gets the sprite name value
`java.lang.String` `getStateValue()` Gets the state value
`java.awt.image.BufferedImage` `grabSprite(java.awt.image.BufferedImage spriteSheet, int x, int y, int width, int height)` Grabs the sprite from the large image containing all the static sprites items
`boolean` `isAnimate()` Gets the 'animate' value
`boolean` `isConvertible()` Gets the convertible value of the object
`boolean` `isDestructible()` Gets the 'destructible' value
`boolean` `isFalling()` Gets the falling state of the object
`boolean` `isImpactExplosive()` Gets the 'impact explosive' value
`boolean` `isMoving()` Gets the 'moving' value
`java.awt.image.BufferedImage` `loadSprite(java.lang.String spriteName)` Loads the target sprite
`void` `setAnimate(boolean animate)` Sets the 'animate' value
`void` `setCollideSound(java.lang.String collideSound)` Sets the collide sound of the object
`void` `setConvertibleValue(boolean convertible)` Sets the convertible value of the object
`void` `setFalling(boolean falling)` Sets the falling state of the object
`void` `setImpactExplosive(boolean impactExplosive)` Sets the 'impact explosive' value
`void` `setPriority(int priority)` Sets the priority of the object
`void` `setSprite(java.awt.image.BufferedImage sprite)` Sets the sprite
`void` `update(long currentTimeMillis)` Function to update the sprites

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DisplayableElementModel

    public DisplayableElementModel(boolean destructible,
                           boolean moving,
                           java.lang.String spriteName,
                           int priority,
                           boolean impactExplosive,
                           boolean animate,
                           boolean falling,
                           java.lang.String collideSound,
                           boolean convertible)

Class constructor

Parameters:
  `destructible` - Object destructible?
  `moving` - Object is moving?
  `spriteName` - Object sprite name?
  `priority` - Object priority?
  `impactExplosive` - Object explodes on impact?
  `animate` - Object can be animated?

#### DisplayableElementModel

    public DisplayableElementModel(boolean destructible,
                           boolean moving,
                           java.lang.String spriteName,
                           int priority,
                           boolean impactExplosive,
                           boolean animate,
                           boolean falling,
                           java.lang.String collideSound)

### Method Detail

#### isDestructible

    public boolean isDestructible()

Gets the 'destructible' value

Returns:
  Whether object is destructible or not

#### isMoving

    public boolean isMoving()

Gets the 'moving' value

Returns:
  Whether object is moving or not

#### getGroupName

    public java.lang.String getGroupName()

Gets the group name value

Returns:
  Group name value

#### getStateValue

    public java.lang.String getStateValue()

Gets the state value

Returns:
  State value

#### getSpriteName

    public java.lang.String getSpriteName()

Gets the sprite name value

Returns:
  Sprite name value

#### getPathToSprite

    public java.lang.String getPathToSprite()

Gets the path to the sprite file in storage

Returns:
  Path to the sprite file in storage

#### getPriority

    public int getPriority()

Gets the priority of the object

Returns:
  Object priority

#### setPriority

    public void setPriority(int priority)

Sets the priority of the object

Parameters:
  `priority` - Object priority

#### isAnimate

    public boolean isAnimate()

Gets the 'animate' value

Returns:
  Whether object is animated or not

#### setAnimate

    public void setAnimate(boolean animate)

Sets the 'animate' value

#### isImpactExplosive

    public boolean isImpactExplosive()

Gets the 'impact explosive' value

Returns:
  Whether object explodes on impact or not

#### setImpactExplosive

    public void setImpactExplosive(boolean impactExplosive)

Sets the 'impact explosive' value

#### setSprite

    public void setSprite(java.awt.image.BufferedImage sprite)

Sets the sprite

Parameters:
  `sprite` - Sprite object

#### getSprite

    public java.awt.image.BufferedImage getSprite()

Gets the sprite

Returns:
  Sprite object

#### loadSprite

    public java.awt.image.BufferedImage loadSprite(java.lang.String spriteName)

Loads the target sprite

Parameters:
  `spriteName` - Sprite name
Returns:
  Sprite object

#### grabSprite

    public java.awt.image.BufferedImage grabSprite(java.awt.image.BufferedImage spriteSheet,
                                          int x,
                                          int y,
                                          int width,
                                          int height)

Grabs the sprite from the large image containing all the static sprites items

Parameters:
  `spriteSheet` - Sprite sheet instance
  `x` - Sub image horizontal offset on sprite sheet
  `y` - Sub image vertical offset on sprite sheet
  `width` - Sub image width on sprite sheet
  `height` - Sub image height on sprite sheet
Returns:
  Target sub image

#### isFalling

    public boolean isFalling()

Gets the falling state of the object

Returns:
  Whether object is falling or not

#### setFalling

    public void setFalling(boolean falling)

Sets the falling state of the object

Parameters:
  `falling` - Whether object is falling or not

#### getCollideSound

    public java.lang.String getCollideSound()

Gets the collide sound of the object

Returns:
  Collide sound

#### setCollideSound

    public void setCollideSound(java.lang.String collideSound)

Sets the collide sound of the object

Parameters:
  `collideSound` - Collide sound

#### isConvertible

    public boolean isConvertible()

Gets the convertible value of the object

Returns:
  Convertible value

#### setConvertibleValue

    public void setConvertibleValue(boolean convertible)

Sets the convertible value of the object

Parameters:
  `convertible` - Convertible value

#### update

    public void update(long currentTimeMillis)

Function to update the sprites

Parameters:
  `currentTimeMillis` - Current time in milliseconds