Class: Cursetank::Cursetank

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

Instance Method Summary collapse

Constructor Details

#initializeCursetank

Returns a new instance of Cursetank.



11
12
13
14
15
# File 'lib/cursetank.rb', line 11

def initialize
  setup_curses
  @win = Curses::Window.new(0, 0, 0, 0)
  main
end

Instance Method Details

#mainObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/cursetank.rb', line 17

def main
  @plantlife_back = setup_plantlife
  @fishes = setup_fishes
  @octopuses = setup_octopuses
  @plantlife_front = setup_plantlife
  @bubbles = []
  loop do
    @plantlife_back.each do | p |
      p.draw
    end
    @fishes.each do | f |
      f.draw
    end
    @octopuses.each do | o |
      o.draw
    end
    @plantlife_front.each do | p |
      p.draw
    end
    generate_bubbles
    @bubbles.each do | b |
      b.draw
    end
    sleep(1.0/15.0)
    @win.clear
    @win.refresh
  end
end