Module: RTanque::Movable

Included in:
Bot, Bot::Radar, Bot::Turret, Explosion, Shell
Defined in:
lib/rtanque/movable.rb

Instance Method Summary collapse

Instance Method Details

#arenaObject


11
12
13
# File 'lib/rtanque/movable.rb', line 11

def arena
  @arena
end

#arena=(val) ⇒ Object


15
16
17
# File 'lib/rtanque/movable.rb', line 15

def arena=(val)
  @arena = val
end

#bound_to_arenaObject


27
28
29
# File 'lib/rtanque/movable.rb', line 27

def bound_to_arena
  true
end

#dead?Boolean

Returns:

  • (Boolean)

7
8
9
# File 'lib/rtanque/movable.rb', line 7

def dead?
  false # should overwrite
end

#headingObject


35
36
37
# File 'lib/rtanque/movable.rb', line 35

def heading
  @heading
end

#heading=(val) ⇒ Object


39
40
41
# File 'lib/rtanque/movable.rb', line 39

def heading=(val)
  @heading = Heading.new(val) if val
end

#positionObject


19
20
21
# File 'lib/rtanque/movable.rb', line 19

def position
  @position
end

#position=(val) ⇒ Object


23
24
25
# File 'lib/rtanque/movable.rb', line 23

def position=(val)
  @position = val
end

#speedObject


43
44
45
# File 'lib/rtanque/movable.rb', line 43

def speed
  @speed
end

#speed=(val) ⇒ Object


47
48
49
# File 'lib/rtanque/movable.rb', line 47

def speed=(val)
  @speed = val if val
end

#tickObject


3
4
5
# File 'lib/rtanque/movable.rb', line 3

def tick
  update_position
end

#update_positionObject


31
32
33
# File 'lib/rtanque/movable.rb', line 31

def update_position
  @position = @position.move(self.heading, self.speed, self.bound_to_arena)
end