1-- This file is a part of Avoision.
2--
3-- Copyright (C) 2012 Jared Krinke.
4--
5-- Avoision is free software; you can redistribute it and/or
6-- modify it under the terms of the GNU General Public License
7-- as published by the Free Software Foundation; either version 2
8-- of the License, or (at your option) any later version.
9--
10-- This program is distributed in the hope that it will be useful,
11-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13-- GNU General Public License for more details.
14--
15-- You should have received a copy of the GNU General Public License
16-- along with this program; if not, write to the Free Software
17-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
19require("UI/UI.lua")
20
21InstructionsMenu = { }
22
23function InstructionsMenu.new()
24    local instructionsForm = Form.newGrid(1, -300, 200, 600)
25
26    -- Activate/cancel exit
27    local title = Title.new("How to Play")
28
29    title.getActive = nil
30
31    function title.inputReceived(self, event, pressed)
32        if pressed then
33            if event == "activate" then
34                Layers.pop()
35            end
36        end
37    end
38
39    local player = ImageLabel.new("Images/Block.png", Common.textHeight, Common.textHeight, "left")
40    local goal = ImageLabel.new("Images/Block.png", Common.textHeight, Common.textHeight, "left")
41    local enemy = ImageLabel.new("Images/Block.png", Common.textHeight, Common.textHeight, "left")
42
43    player.color = Common.playerColor
44    goal.color = Common.goalColor
45    enemy.color = Common.enemyColor
46
47    instructionsForm:add(title)
48
49    instructionsForm:add(Form.newNestedGrid(2,
50        Separator.new(), Separator.new(),
51        player,          Label.new("MOVE the green square"),
52        Separator.new(), Label.new("(using arrow keys by default)"),
53        Separator.new(), Separator.new(),
54        goal,            Label.new("HIT the red square to score points"),
55        Separator.new(), Label.new("(the faster you get to it, the more"),
56        Separator.new(), Label.new("points you score)"),
57        Separator.new(), Separator.new(),
58        enemy,           Label.new("AVOID the obstacles that appear"),
59        Separator.new(), Separator.new(),
60        Separator.new(), Label.new("COMPETE to get the highest score!")))
61
62    return FormLayer.new(instructionsForm)
63end
64
65