Class: Ship

Inherits:
Unit show all
Defined in:
lib/lib/units/ship.rb

Instance Attribute Summary

Attributes inherited from Unit

#armour_left, #cargo, #cargo_max, #faction, #function, #x, #y

Instance Method Summary collapse

Methods inherited from Unit

#attack!, #can_be_built?, #can_be_captured?, #can_build?, #can_capture?, #can_fly?, #can_move?, #can_ride?, #can_transport?, #capture!, #check_movement, #destroy!, #draw, #engage!, #function!, #info, #is_full?, #is_terrain_suitable?, #is_transported?, #is_transporting?, #is_waiting_for_commands?, #reset_moves!, #set_function!, #to_s

Constructor Details

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

Returns a new instance of Ship.



9
10
11
12
13
14
15
16
17
# File 'lib/lib/units/ship.rb', line 9

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

  @armour_left = @armour_max = 1
  @moves_max = 2
  @cargo_max = 3
end

Instance Method Details

#can_sail?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/lib/units/ship.rb', line 19

def can_sail?
  true
end