Class: Pixiurge::Display::Invisible

Inherits:
Pixiurge::Displayable show all
Defined in:
lib/pixiurge/displayable/invisible.rb

Overview

An Invisible Displayable is just a visual no-op - showing and hiding it do nothing. You could use a single empty spritestack to get the same effect. This permits "showing" items that shouldn't have any visible presence without doing something too tricky.

Since:

  • 0.1.0

Instance Attribute Summary

Attributes inherited from Pixiurge::Displayable

#block_height, #block_width, #displayable_type, #location_displayable, #location_name, #name, #position, #x, #y

Instance Method Summary collapse

Methods inherited from Pixiurge::Displayable

#show_to_player

Constructor Details

#initialize(name:, engine_connector:) ⇒ Invisible

Constructor

Parameters:

  • name (String)

    The Demiurge item name for this Displayable

  • engine_connector (Pixiurge::EngineConnector)

    The Pixiurge EngineConnector this Displayable belongs to

Since:

  • 0.1.0



13
14
15
16
# File 'lib/pixiurge/displayable/invisible.rb', line 13

def initialize name:, engine_connector:
  super
  @displayable_type = "invisible"  # This should never go over the network, though...
end

Instance Method Details

#destroy_for_player(player) ⇒ Object

Do nothing to hide an Invisible object

Since:

  • 0.1.0



28
29
# File 'lib/pixiurge/displayable/invisible.rb', line 28

def destroy_for_player(player)
end

#messages_to_show_player(player) ⇒ Object

Do nothing to display an Invisible object, don't call super

Since:

  • 0.1.0



21
22
23
# File 'lib/pixiurge/displayable/invisible.rb', line 21

def messages_to_show_player(player)
  []
end

#move_for_player(player, old_pos, new_pos, options) ⇒ Object

Do nothing to move an Invisible object

Since:

  • 0.1.0



34
35
# File 'lib/pixiurge/displayable/invisible.rb', line 34

def move_for_player(player, old_pos, new_pos, options)
end