Class: Swarm::Two
Instance Method Summary
collapse
Methods inherited from Level
each, #find_player, #initialize, #move, #move_player, #over?, #spawn_player, #update, #update!
Constructor Details
This class inherits a constructor from Swarm::Level
Instance Method Details
#play ⇒ Object
4
5
6
7
8
9
10
|
# File 'lib/swarm/levels/two.rb', line 4
def play
Catalog.select(*i[worker soldier]).each do |tile|
move tile, @player
end
true
end
|
#setup ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/swarm/levels/two.rb', line 27
def setup
@map.each &:empty!
@map.spawn :dirt!, 30
@map.spawn :rock!, 5
@map.spawn :worker!, 0.5
@map.spawn :soldier!, 0.15
@map.center.player!
end
|
#show(players) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/swarm/levels/two.rb', line 13
def show(players)
pause do
"\n - LEVEL 2 -\n\n\n Press %<pause>s to start.\n\n (\#{players} lives remaining)\n POPUP\n end\nend\n".gsub(/[ ]{10}/, '') % Console.key_info
|