Class: Termfront::Opponent

Inherits:
Object
  • Object
show all
Defined in:
lib/termfront/opponent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x:, y:, angle:, shield: Config::SHIELD_MAX, health: Config::HEALTH_MAX, weapon: :ar, ammo: 60, fire_flash: 0) ⇒ Opponent

Returns a new instance of Opponent.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/termfront/opponent.rb', line 7

def initialize(x:, y:, angle:, shield: Config::SHIELD_MAX, health: Config::HEALTH_MAX, weapon: :ar, ammo: 60,
               fire_flash: 0)
  @x = x
  @y = y
  @angle = angle
  @shield = shield
  @health = health
  @weapon = weapon
  @ammo = ammo
  @fire_flash = fire_flash
end

Instance Attribute Details

#ammoObject

Returns the value of attribute ammo.



5
6
7
# File 'lib/termfront/opponent.rb', line 5

def ammo
  @ammo
end

#angleObject

Returns the value of attribute angle.



5
6
7
# File 'lib/termfront/opponent.rb', line 5

def angle
  @angle
end

#fire_flashObject

Returns the value of attribute fire_flash.



5
6
7
# File 'lib/termfront/opponent.rb', line 5

def fire_flash
  @fire_flash
end

#healthObject

Returns the value of attribute health.



5
6
7
# File 'lib/termfront/opponent.rb', line 5

def health
  @health
end

#shieldObject

Returns the value of attribute shield.



5
6
7
# File 'lib/termfront/opponent.rb', line 5

def shield
  @shield
end

#weaponObject

Returns the value of attribute weapon.



5
6
7
# File 'lib/termfront/opponent.rb', line 5

def weapon
  @weapon
end

#xObject

Returns the value of attribute x.



5
6
7
# File 'lib/termfront/opponent.rb', line 5

def x
  @x
end

#yObject

Returns the value of attribute y.



5
6
7
# File 'lib/termfront/opponent.rb', line 5

def y
  @y
end

Instance Method Details

#dup_stateObject



19
20
21
22
# File 'lib/termfront/opponent.rb', line 19

def dup_state
  Opponent.new(x: @x, y: @y, angle: @angle, shield: @shield, health: @health,
               weapon: @weapon, ammo: @ammo, fire_flash: @fire_flash)
end