Class: Swarm::One
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/one.rb', line 4
def play
Catalog.select(:worker).each do |tile|
move tile, @player
end
true
end
|
#setup ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/swarm/levels/one.rb', line 25
def setup
@map.each &:empty!
@map.spawn :dirt!, 30
@map.spawn :rock!, 5
@map.spawn :worker!, 0.75
@map.center.player!
end
|
#show(players) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/swarm/levels/one.rb', line 12
def show(players)
pause do
"\n - LEVEL 1 -\n\n Press %<pause>s to start.\n\n (\#{players} lives remaining)\n POPUP\n end\nend\n".gsub(/[ ]{10}/, '') % Console.key_info
|