BattleCity.Environment behaviour (battle_city v0.1.8) View Source

Environment

Link to this section Summary

Link to this section Types

Specs

env_object() :: BattleCity.Tank.t() | BattleCity.Bullet.t()

Specs

t() :: %BattleCity.Environment{
  __module__: module(),
  enter?: boolean(),
  health: health(),
  id: BattleCity.id(),
  position: BattleCity.Position.t(),
  raw: binary(),
  shape: shape(),
  solid?: boolean()
}

Link to this section Functions

Specs

copy_rxy(t(), env_object()) :: env_object()

Specs

copy_xy(t(), env_object()) :: env_object()
Link to this function

handle_enter(environment, bullet)

View Source

Specs

handle_enter(t(), env_object()) :: enter_result()

Specs

handle_hit(t(), map()) :: {atom(), t()}

Specs

handle_init(map()) :: map()
Link to this function

handle_leave(environment, o)

View Source

Specs

handle_leave(t(), env_object()) :: enter_result()

Specs

reset(t(), module()) :: t()

Link to this section Callbacks

Link to this callback

handle_enter(t, env_object)

View Source

Specs

handle_enter(t(), env_object()) :: enter_result()
Link to this callback

handle_init(map)

View Source (optional)

Specs

handle_init(map()) :: map() | {:error, :atom}
Link to this callback

handle_leave(t, env_object)

View Source

Specs

handle_leave(t(), env_object()) :: enter_result()