Module: RTanque::Movable
- Included in:
- Bot, Bot::Radar, Bot::Turret, Explosion, Shell
- Defined in:
- lib/rtanque/movable.rb
Instance Method Summary collapse
- #arena ⇒ Object
- #arena=(val) ⇒ Object
- #bound_to_arena ⇒ Object
- #dead? ⇒ Boolean
- #heading ⇒ Object
- #heading=(val) ⇒ Object
- #position ⇒ Object
- #position=(val) ⇒ Object
- #speed ⇒ Object
- #speed=(val) ⇒ Object
- #tick ⇒ Object
- #update_position ⇒ Object
Instance Method Details
#arena ⇒ Object
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_arena ⇒ Object
27 28 29 |
# File 'lib/rtanque/movable.rb', line 27 def bound_to_arena true end |
#dead? ⇒ Boolean
7 8 9 |
# File 'lib/rtanque/movable.rb', line 7 def dead? false # should overwrite end |
#heading ⇒ Object
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 |
#position ⇒ Object
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 |
#speed ⇒ Object
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 |
#tick ⇒ Object
3 4 5 |
# File 'lib/rtanque/movable.rb', line 3 def tick update_position end |
#update_position ⇒ Object
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 |