Class: Town

Inherits:
Unit show all
Defined in:
lib/town.rb

Instance Attribute Summary collapse

Attributes inherited from Unit

#cargo, #faction, #function, #x, #y

Instance Method Summary collapse

Methods inherited from Unit

#can_fly?, #can_move, #can_ride?, #can_sail?, #can_transport?, #capture, #check_movement, #destroy, #draw, #function!, #info, #is_transporting?, #reset_moves, #set_function, #tile_check, #to_s, #update

Constructor Details

#initialize(x, y, faction, map, infopane) ⇒ Town

Returns a new instance of Town.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/town.rb', line 6

def initialize(x, y, faction, map, infopane)
  super
  dir_path = File.dirname(__FILE__)
  @image = Gosu::Image.new(dir_path + '/media/town.png')

  @name = 'town'
  @value = 20
  @armor_left = @armor_max = 1
  @moves_max = 0

  @parts_built = 0
  @cargo_max = 10
  set_function(FUNCBUILD)
end

Instance Attribute Details

#parts_builtObject

Returns the value of attribute parts_built.



4
5
6
# File 'lib/town.rb', line 4

def parts_built
  @parts_built
end

Instance Method Details

#can_build?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/town.rb', line 21

def can_build?
  true
end