Class: Wall

Inherits:
Entity show all
Defined in:
lib/game_2d/wall.rb

Constant Summary

Constants included from EntityConstants

EntityConstants::CELL_WIDTH_IN_PIXELS, EntityConstants::MAX_VELOCITY, EntityConstants::PIXEL_WIDTH, EntityConstants::WIDTH

Instance Attribute Summary

Attributes inherited from Entity

#a, #moving, #space, #x, #x_vel, #y, #y_vel

Instance Method Summary collapse

Methods inherited from Entity

#accelerate, #angle_to_vector, #as_json, #bottom_cell_y, bottom_cell_y_at, #destroy!, #direction_to, #doomed?, #draw, #draw_zorder, #drop_diagonal, #empty_above?, #empty_on_left?, #empty_on_right?, #empty_underneath?, #entities_obstructing, #going_past_entity, #harmed_by, #i_hit, #image_filename, #left_cell_x, left_cell_x_at, #move, #move_x, #move_y, #next_to, #occupied_cells, #opaque, #pixel_x, #pixel_y, #right_cell_x, right_cell_x_at, #should_fall?, #top_cell_y, top_cell_y_at, #transparent_to_me?, #update, #update_from_json, #vector_to_angle, #warp

Methods included from Registerable

#nullsafe_registry_id, #registry_id=, #registry_id?, #registry_id_safe

Methods included from Serializable

#<=>, #==, as_json, #eql?, from_json, #hash, #to_json, #update_from_json

Constructor Details

#initialize(space, cell_x, cell_y) ⇒ Wall

Returns a new instance of Wall.



4
5
6
7
# File 'lib/game_2d/wall.rb', line 4

def initialize(space, cell_x, cell_y)
  super(cell_x * Entity::WIDTH, cell_y * Entity::HEIGHT)
  self.space = space
end

Instance Method Details

#all_stateObject



20
# File 'lib/game_2d/wall.rb', line 20

def all_state; [x, y]; end

#moving=(moving) ⇒ Object



10
# File 'lib/game_2d/wall.rb', line 10

def moving=(moving); end

#moving?Boolean

Returns:

  • (Boolean)


9
# File 'lib/game_2d/wall.rb', line 9

def moving?; false; end

#registry_idObject



15
# File 'lib/game_2d/wall.rb', line 15

def registry_id; "Wall[#{left_cell_x}x#{top_cell_y}]"; end

#sleep_now?Boolean

Returns:

  • (Boolean)


12
# File 'lib/game_2d/wall.rb', line 12

def sleep_now?; true; end

#to_sObject



16
17
18
# File 'lib/game_2d/wall.rb', line 16

def to_s
  "Wall at #{left_cell_x}x#{top_cell_y} (#{x}x#{y})"
end

#wake!Object



13
# File 'lib/game_2d/wall.rb', line 13

def wake!; end