-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentations.tex
More file actions
396 lines (377 loc) · 11.4 KB
/
documentations.tex
File metadata and controls
396 lines (377 loc) · 11.4 KB
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{titling}
\newcommand{\subtitle}[1]{
\posttitle{
\par\end{center}
\begin{center}\large#1\end{center}
\vskip0.5em
}
}
\geometry{margin=1in}
\title{Documentation}
\subtitle{KickShot}
\date{\today}
\begin{document}
\maketitle
\section*{main.js}
These variables are included in the body of the main file.
\begin{itemize}
\item game.HUMAN
\item game.AI
\item game.GoalAttempt
\item game.HumanScore
\item game.AiScore
\item game.MaxScore
\item game.Doubles
\item game.DiceHideSpeed
\item game.CardHideSpeed
\end{itemize}
\subsection*{createScene 'Main'}
This section runs the start screen.
Variables:
\begin{itemize}
\item backgroundColor
\item title
\item playButton
\item webButton
\item characters
\item cycle
\item charSprite
\item charIndex
\item inPlayClick
\end{itemize}
\subsubsection*{init()}
Sets up the start screen. Rotates the character sprites.
\subsubsection*{playClick()}
Beings the actual game-play.
\subsubsection*{webClick()}
Opens the kickshot link.
\subsubsection*{nextCharacter()}
Rotates the character sprites.
\subsection*{createScene 'Game'}
Runs the game-play.
Variables include:
\begin{itemize}
\item backgroundColor
\item dice
\item message
\item aiScoreText
\item humanScoreText
\item canTap
\item inMessage
\item afterMessage
\item turn
\item possession
\item playerDeck
\item playerHand
\item canPlayCards
\item aiDeck
\item aiHand
\item chip
\item chipZone
\item gamePhase
\item kickoff
\item goalKick
\item helpButton
\item rules
\item backButton
\item \_this
\item activeSprite
\item messageText
\item boardZone
\end{itemize}
\subsubsection*{init()}
Sets up the playing field, deck, hand, and buttons.
\subsubsection*{enableInput()}
This makes it so taps and clicks are used for input.
\subsubsection*{disableInput()}
This makes it so taps and clicks are ignored.
\subsubsection*{helpClick()}
Brings out the rules for the game.
\subsubsection*{backClick()}
Brings the player back to the main screen.
\subsubsection*{hideRulesClick()}
Removes the rules sprite.
\subsubsection*{humanTurn()}
This function checks whether kickoff is true, then sets the gamePhase
to 1 if it is true, or if it is not true, gamePhase is set to 3.
\subsubsection*{aiTurn()}
This function checks whether kickoff is true, then calls aiKickoff if
it is true, or does other operations if it is not true.
\subsubsection*{fieldClick()}
This function should be called when the field is clicked, is input
is enabled. This function checks the gamePhase and performs various
functions based on that.
\subsubsection*{aiKickoff(callback)}
This function performs a kickoff while it is the AI's turn.
The callback parameter is not used.
%is this correct?
\subsubsection*{aiGoalKick()}
This function handles moving the ball after the AI blocks a goal
attempt.
\subsubsection*{AiPass()}
This function handles the AI passing and includes code to control how
frequently it succeeds.
\subsubsection*{AiIntercept()}
This function handles the AI attempting to intercept the ball and includes code to control how
frequently it succeeds.
\subsubsection*{AiGoalShot(Direction)}
This function handles the AI attempting a goal shot.
\subsubsection*{hideDice(callback)}
This function hides the dice sprites and calls the callback
parameter.
\subsubsection*{showDice(callback)}
This function shows the dice sprites and calls the callback
parameter.
\subsubsection*{rollDice(whichPlayer,callback)}
This function calls dice roll functions from the dice.js file
for players indicated by the whichPlayer parameter. The callback
parameter is run, after some timers.
\subsubsection*{showHand(callback)}
This function calls the showCards() method from the cardMenu.js
file. The callback parameter is not used.
\subsubsection*{hideHand(callback)}
This function calls the hideCards()method from the cardMenu.js file.
The callback parameter is not used.
\subsubsection*{changePossession()}
The function changes possession of the ball by changing the
possession variable.
\subsubsection*{centerBall()}
This function sets the ball n the middle of the field.
\subsubsection*{updateBallTexture()}
This function sets the chip sprite according to possession.
\subsubsection*{blockGoal()}
This function is called when a goal is blocked. It shows a message
and reassigns possession.
\subsubsection*{moveBall(move,callback)}
Moves the active chipZone, moves the chip sprite to a new location
indicated by the move parameter. The callback parameter is then
called.
\subsubsection*{advanceToken()}
An old function. moveBall replaced this.
\subsubsection*{goalShot()}
Displays the GoalShot message.
\subsubsection*{endTurn()}
Starts the other player's turn.
\subsubsection*{scoreGoal()}
Increments score for scoring player, resets the chip sprite and
chipZone.
\subsubsection*{replacePlayerCard(cardNumber)}
Draws a card to replace a card in the player's hand.
\subsubsection*{drawCard(whichPlayer)}
Takes a card off whichPlayer's deck.
\subsubsection*{printPlayerHand()}
Logs the player's hand to the console.
\subsubsection*{showMessage(msgType,after)}
Shows a message on the screen.
\subsubsection*{hideMessage(after)}
Removes a message from the screen.
\subsubsection*{gameOver()}
Resets various variables.
\subsubsection*{updateScore()}
Changes the on screen score text to the current score.
\subsubsection*{pause(timeToPause)}
Runs a timer for an inputted time.
\subsubsection*{testPlayable(cardName)}
Returns a boolean depending on whether the card is playable.
\subsubsection*{skipClick(mouseData)}
This function is called when the skip button is pressed, and ends the turn.
\subsubsection*{clickCard0(mouseData)}
Checks whether the card is playable, and if so, plays it.
\subsubsection*{clickCard1(mouseData)}
Checks whether the card is playable, and if so, plays it.
\subsubsection*{clickCard2(mouseData)}
Checks whether the card is playable, and if so, plays it.
\subsubsection*{clickCard3(mouseData)}
Checks whether the card is playable, and if so, plays it.
\subsubsection*{clickCard4(mouseData)}
Checks whether the card is playable, and if so, plays it.
\subsubsection*{clickCard5(mouseData)}
Checks whether the card is playable, and if so, plays it.
\subsubsection*{playCard(whichCard)}
This function is called by the clickCard functions to call the
appropriate functions for the cards.
\subsubsection*{displayMessageSprite(messageString,callback)}
This function displays a message on the screen, and then runs a callback
function.
\subsubsection*{playerPass()}
This function sets up the dice and gamePhase for the player to roll for a pass.
\subsubsection*{playerIntercept()}
This function sets up the dice and gamePhase for the player to roll for an intercept.
\subsubsection*{playerGoalShot(Direction)}
This function handles a player's attempt at a goal shot.
\section*{dice.js}
This file handles the dice, rolling, hiding and showing dice
sprites.
\subsection*{createClass 'Dice'}
Variables include:
\begin{itemize}
\item rolling
\item value1
\item value2
\item timing
\end{itemize}
\subsubsection*{init()}
This function adds the dice sprite objects, positions, and anchors.
\subsubsection*{update()}
This changes the dice textures to random values.
\subsubsection*{show()}
This moves the dice sprites onto the screen.
\subsubsection*{hide()}
This moves the dice sprites off of the screen.
\subsubsection*{roll(whichPlayer)}
This sets the rolling variable to true and sets the dice positions to
match whichPlayer.
\subsubsection*{stopRoll()}
Sets rolling to false.
\subsubsection*{setPlayerPosition()}
Sets the dice positions to a position for the player.
\subsubsection*{setAiPosition()}
Sets the dice positions to a position for the AI.
\subsubsection*{setBothPositions()}
Sets the dice positions to a position for the player and the AI.
\subsubsection*{reset()}
Sets the dice values and textures to one.
\section*{deck.js}
This file handles the deck of cards, generation, shuffling, drawing
cards.
\subsection*{createClass 'Deck'}
Variables include:
\begin{itemize}
\item offenseSubDeck
\item defenseSubDeck
\item deck
\item top6Cards
\item homeOffenseCards
\item homeDefenseCards
\item awayOffenseCards
\item awayDefenseCards
\end{itemize}
\subsubsection*{init(side)}
Calls buildDeck for the side given.
\subsubsection*{buildDeck(side)}
Builds the deck, top6Cards, offence, and defence lists for the side given.
\subsubsection*{draw()}
Returns the top card from the deck.
\subsubsection*{printDeck()}
Logs the deck to the console.
\subsubsection*{printSubDecks()}
Prints the offence and defence sub-decks to the console.
\subsubsection*{shuffle(array)}
Reorders the given array.
\section*{config.js}
This file contains screen size, name, and version information.
\begin{itemize}
\item name
\item version
\item width
\item height
\item rotateScreen
\item id
\end{itemize}
\
section*{cardMenu.js}
This file handles the card menu, hand, buttons, and layout.
\subsection*{createClass 'CardMenu'}
Variables include:
\begin{itemize}
\item cards
\item skipButton
\item animating
\end{itemize}
\subsubsection*{init()}
Moves the cards and skip button into place.
\subsubsection*{mouseOutCard(mousedata)}
Moves and resizes a card when the mouse moves off of it.
\subsubsection*{mouseOverCard(mouseData)}
Moves and resizes a card when the mouse moves over it.
\subsubsection*{mouseOverSkip(mousedata)}
Changes the skip button sprite when the mouse moves over it.
\subsubsection*{mouseOutSkip(mousedata)}
Changes the skip button sprite when the mouse moves off of it.
\subsubsection*{updateCards(cardsInHand)}
Updates the card sprites to match the cards in the hand.
\subsubsection*{hideCard(cardNumber)}
\subsubsection*{resetShowingPosition()}
Resets the cards' display positions.
\subsubsection*{resetHiddenPosition()}
Resets the cards' hidden positions.
\subsubsection*{drawCard2(cardNumber)}
Draws a new card and updates the texture.
\subsubsection*{updateCard(newName,cardNumber)}
Sets the cards to the correct sprites.
\subsubsection*{hideCard(cardNumber)}
Hides the indicated card.
\subsubsection*{hideCards()}
Hides all the cards.
\subsubsection*{showCard(cardNumber)}
Shows a card.
\subsubsection*{showCards()}
Shows all the cards.
\subsubsection*{isPlayable(cardName,currentPlayer,currentPossession,
ballZone)}
Checks to see if a cards is playable.
\subsubsection*{enlargeCard()}
Does nothing
\subsubsection*{printCards()}
Prints card number and name to the console.
\section*{assests.js}
This file adds all of the sprites used in the game.
These include:
\begin{itemize}
\item raccon
\item hare
\item jaguar
\item weasel
\item lion
\item dog
\item crocodile
\item elephant
\item panda
\item goat
\item field
\item chip-home
\item chip-away
\item title
\item play
\item play-click
\item web
\item web-click
\item help
\item help-click
\item close
\item dice1
\item dice2
\item dice3
\item dice4
\item dice5
\item dice6
\item Goal\_home
\item Goal\_away
\item GoalBlock\_home
\item GoalBlock\_away
\item Intercept\_home
\item Intercept\_away
\item GoalShot\_home
\item GoalShot\_away
\item End\_home
\item End\_away
\item Direct\_Free\_Kick
\item Goal\_Blocked\_Away\_Left
\item Goal\_Blocked\_Away\_Right
\item Goal\_Blocked\_Home\_Left
\item Goal\_Blocked\_Home\_Right
\item Goal\_Shot\_Away\_Left
\item Goal\_Shot\_Away\_Right
\item Goal\_Shot\_Home\_Left
\item Goal\_Show\_Home\_Right
\item Intercept\_Away
\item Intercept\_Home
\item Pass\_Away
\item Pass\_Home
\item rules
\item skipover
\item skip
\end{itemize}
\end{document}