forked from Tobbe/robotgame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
107 lines (100 loc) · 4.01 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Robot Game</title>
<link rel="stylesheet" href="style.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="game_area">
<canvas class="game_menu" width="780" height="450"></canvas>
<canvas class="field" width="410" height="450"></canvas>
<form>
<textarea cols="30" rows="20" placeholder="Write your program here"></textarea>
<input type="button" class="run" value="Run" />
<input type="reset" class="reset" value="Clear" />
</form>
</div>
<input type="button" class="restart" value="Restart" />
<div class="instructions">
<h1>Instructions</h1>
<p>
To control the robot you have to give it programming instructions.
The available instructions are:
</p>
<code class="info-area">
robot.moveRight(int steps);<br>
robot.moveLeft(int steps);<br>
robot.moveUp(int steps);<br>
robot.moveDown(int steps);<br>
robot.pushButton();<br>
robot.openChest();<br>
robot.hasRedKey();<br>
robot.hasGreenKey();<br>
robot.hasBlueKey();<br>
if (robot.has<Color>Key()) {<br>
robot.<SomeMethod>();<br>
}<br>
robot.openDoor();
</code>
<p>
All move-functions take one parameter, called <code>steps</code>.
The type of this parameter is <code>int</code>, which just means
that it should be a whole number, written using digits. If the
parameter is omitted it is assumed that just one step in the given
direction should be taken.
</p>
<p>
For example, the following program would make the robot walk two
steps to the right, and then one step up.
</p>
<code class="info-area">
robot.moveRight(2);<br>
robot.moveUp(1);
</code>
<p>
When the robot stands on a button it can push it using the
<code>pushButton</code> function. This function takes no
parameters.
</p>
<p>
When the robot stands on a chest it can open it using the
<code>openChest</code> function. Whatever is in the chest will be
collected by the robot. This function takes no parameters.
</p>
<p>
To open red, green and blue doors a key is needed. To check if the
robot has the required key the <code>hasRedKey</code>,
<code>hasGreenKey</code> and <code>hasBlueKey</code> methods should be
used.
</p>
<p>
The <code>has<Color>Key</code> methods described above will
most likely be used together with the <code>if</code> statement.
The <code>if</code> statement takes a method call that returns
<code>true</code> or <code>false</code> as a parameter, and if
the call returns true the single instruction inside the <code>
if</code> statement is executed.
</p>
<p>
When the robot stands on a door it can open it using the <code>
openDoor</code> method. If the door is red, green or blue a key
with the same color as the door is needed.
</p>
</div>
<script src="jquery-2.1.4.js"></script>
<script src="script.js"></script>
<div class="hidden">
<!-- prefetch all pictures -->
<img src="img_push/robot_push_1.png">
<img src="img_push/robot_push_2.png">
<img src="img_push/robot_push_3.png">
<img src="img_push/robot_push_4.png">
<img src="img_push/robot_push_5.png">
<img src="img_push/button_push_1.png">
<img src="img_push/button_push_2.png">
<img src="img_push/button_push_3.png">
</div>
</body>
</html>