-
Notifications
You must be signed in to change notification settings - Fork 10
/
Game-Development.html
175 lines (152 loc) · 9.05 KB
/
Game-Development.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<title>Snake Game-Phaser</title>
<!-- Meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="favicon.ico">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<!-- Global CSS -->
<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">
<!-- Plugins CSS -->
<link rel="stylesheet" href="assets/plugins/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="assets/plugins/prism/prism.css">
<link rel="stylesheet" href="assets/plugins/elegant_font/css/style.css">
<!-- Theme CSS -->
<link id="theme-style" rel="stylesheet" href="assets/css/styles.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="body-green">
<div class="page-wrapper">
<!-- ******Header****** -->
<header id="header" class="header">
<div class="container">
<div class="branding">
<h1 class="logo">
<a href="index.html">
<span aria-hidden="true" class="icon_documents_alt icon"></span>
<span class="text-highlight">Game Development</span>
</a>
</h1>
</div>
<!--//branding-->
<ol class="breadcrumb">
<li><a href="index.html">Home</a></li>
<li class="active">Game Development</li>
</ol>
</div>
<!--//container-->
</header>
<!--//header-->
<div class="doc-wrapper">
<div class="container">
<div id="doc-header" class="doc-header text-center">
<h1 class="doc-title"><i class="icon fa fa-paper-plane"></i>Game Development</h1>
<div class="meta"><i class="fa fa-clock-o"></i> Snake Game using Phaser</div>
</div>
<div class="doc-body">
<div class="doc-content">
<div class="content-inner">
<section id="introduction-section" class="doc-section">
<h2 class="section-title">Introduction</h2>
<div class="section-block">
<p>Everybody loves classic games. How many of you remember the retro snake game from old Nokia phones? We sure do. This is why for this lesson we decided to recreate it using HTML5. There is a great open source game development framework called Phaser that we will use.
You will learn about sprites, game states and how to use the preload, create and update methods</p>
</div>
</section>
<!--//doc-section-->
<section id="gamesdev-section" class="doc-section">
<h2 class="section-title">Setup</h2>
<div id="step1" class="section-block">
<p> Download a zip archive with the file structure of the game <a href="https://drive.google.com/file/d/1X1KRleI1UOh5KgCRUuZPfKXhY4mbGmEH/view?usp=sharing">here</a> It contains all the image assets needed for the game but no code. We will be writing this next.<br>
Now open <b>index.html</b>, add a title for your page and create links to all the JS files. Later, to play the game, just open this file in your browser.</p>
<pre><code class="language-markup"><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Snake Game using Phaser</title>
<script src="assets/js/phaser.min.js"></script>
<script src="assets/js/menu.js"></script>
<script src="assets/js/game.js"></script>
<script src="assets/js/game_over.js"></script>
<script src="assets/js/main.js"></script>
</head>
<body>
</body>
</html></code></pre>
<p>Your directory should look like this:</p>
<img src="assets/images/demo/dir.png" alt="Directory View" />
</div>
<!--//section-block-->
</section>
</div>
<!--//content-inner-->
<div class="content-inner">
<section id="nextsteps-section" class="doc-section">
<h2 class="section-title">How the Game is organized</h2>
<div class="section-block">
<p>Phaser games are organized around states. Think of states in Phaser as the different parts of a game. Here are the states of our game:
<ul>
<li>The <b>Menu</b> state. It is handled by <b>menu.js</b>, and only displays the start image. When it is clicked, the game transitions to the <b>Game</b> state.</li>
<li><b>Game</b> state. It is handled by <b>game.js</b>. This is the actual play area of the game. You control the snake, eat apples and have lots of fun. When you die, you transition to the Game_Over state.</li>
<li><b>Game_Over</b> state. It shows <b>gameover.png</b> and displays your last score. When it is clicked you transition to the Game state.</li>
</ul>
<b>main.js</b> is our main JavaScript file. This is the place where we will create a new game instance and add a menu state.</p>
</div>
</section>
<!--//doc-section-->
<!--//doc-section-->
</div>
<!--//content-inner-->
</div>
<!--//doc-content-->
<div class="doc-sidebar hidden-xs">
<nav id="doc-nav">
<ul id="doc-menu" class="nav doc-menu" data-spy="affix">
<li><a href="Game-Development.html">Intro & Setup</a></li>
<li><a href="Lesson-1.html">Loading an Image</a></li>
<li><a href="Lesson-2.html">Drawing the Snake</a></li>
<li><a href="Lesson-3.html">Movement and Control</a></li>
<li><a href="Lesson-4.html">Collision Detection</a></li>
</ul>
<!--//doc-menu-->
</nav>
</div>
<!--//doc-sidebar-->
</div>
<!--//doc-body-->
</div>
<!--//container-->
</div>
<!--//doc-wrapper-->
</div>
<!--//page-wrapper-->
<footer id="footer" class="footer text-center">
<div class="container">
<!--/* This template is released under the Creative Commons Attribution 3.0 License. Please keep the attribution link below when using for your own project. Thank you for your support. :) If you'd like to use the template without the attribution, you can check out other license options via our website: themes.3rdwavemedia.com */-->
<small class="copyright"><p class="license">Portions of this content are ©1998–2016 by individual mozilla.org contributors. Content available under a <a href="https://www.mozilla.org/foundation/licensing/website-content/">Creative Commons license</a>.</p></small>
</div>
<!--//container-->
</footer>
<!--//footer-->
<!-- Main Javascript -->
<script type="text/javascript" src="assets/plugins/jquery-1.12.3.min.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/plugins/prism/prism.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-scrollTo/jquery.scrollTo.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-match-height/jquery.matchHeight-min.js"></script>
<script type="text/javascript" src="assets/js/main.js"></script>
</body>
</html>