-
Notifications
You must be signed in to change notification settings - Fork 0
/
whiteboard.js
168 lines (145 loc) · 5.23 KB
/
whiteboard.js
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
//! Sign Off - Fri Lunch
//! WTF - Sat Morning
//! MVP - Monday Evening
// ? Minimum Requirements
// TODO: Create HTML page, Add basic structural elements
// TODO Place cells into grid.innerHTML
// TODO: Place structural objects on map
// TODO:
// TODO: Define Game Objects, non-animated
// TODO: Define Map Objects
// TODO: Define movements and map to keyboard keys
//FOR EACH character
//IF character.behaviour = 'manual'- Listen for keyDown - character.nextDirection = Event
// ELSE character.nextDirection = (use random on directionArray [up, down, left, right])
// setInterval based on this.character.speed
//findNextCell() calculate nextCell from cellArray number based on character.currentCell, direction key pressed, map.cellArray, character.nextCell = cellArray[?] //
// IF grid edge, move to the opposite side of grid (teleport)
// ELSE
// check content of nextCell (nextCell.classList.get)
// IF (nextCell.classList.contains === 'ghost' && mode === 'normal)
// lose life function lives--
// IF lives === 0 - mode = 'Game Over' return gameover() // display game over, display reset button // stretch: highScore()
// ELSE reset all character positions to character.startPosition
// ELSE IF (nextCell contains 'ghost' && mode === 'energised') // points += (100 * difficulty)
// ELSE IF (nextCell contains wall) // character.player stops, return // More advanced in stretch
// ELSE IF nextCell contains 'food' points += (1 * difficulty), classList.remove('food'), foodCount--
// IF (foodCount > 0) makeMove()
// ELSE levelWin() - resetCharacter (all), difficulty++,
// ELSE IF nextCell contains 'fruit' points += (10 * difficulty), makeMove()
// ELSE makeMove() // remove character class from current cell and place in nextCell using makeMove function
//TODO pills , time-limit,
// nextCell
// ! Characters
const character = [{
name: 'player',
behaviour: 'manual',
lives: 4,
speed: 100, // variable depending on game.mode
standardSpeed: 100,
energisedSpeed: 200,
currentCell: 1, // variable
currentDirection: 'up', // (up, down, left, right)
nextCell: 2, // based on cellArray
nextDirection: 'right',
}, {
name: 'Blinky',
behaviour: 'Basic',
speed: 100, // variable depending on game.mode
standardSpeed: 100,
energisedSpeed: 150,
currentCell: 0, // variable
currentDirection: 'up', // (up, down, left, right)
nextCell: 0, // based on cellArray
nextDirection: '',
}] // TODO Add 3 more ghost characters
const directionArray = [up, down, left, right]
const map = {
Name: 'name',
Width: 0, // ? Square or rectangular, how does this affect game mechanics/calculations?
cellArray: ['.', ' ', 'X'],
// * GamePlay Settings
Difficulty: 1, // ? 1-10?
playerStartPosition: 1, //(cellArray[?])
ghostStartPosition: 5,
}
// * Board
// Grid similar to that of Nicks, with a dinamically created board based on width
// Logic - Grid edge will allow movement from one side of the grid to the other
// Map blocks will need to prevent movement
// Board as an array, (map.cellArray)
// ? Will probably be quicker to create multple maps by building a map builder
// * Map Builder
// Grid Dimensions to add grid to page
// ? force square for easier game logic are allow rectangular?
// click select object, click place start on grid co-ordinates, click place finish to add objects in a straight line between start and finish
// TODO - Map Objects - Define different type of objects
//
// * HTML Page
// TODO - H1 Title
// TODO - div current score
// TODO - div high score
// TODO - div game
// TODO --> div grid
// grid takes demension from height and width variable, uses flex
// ? grid could dynamically calculate height and width for cellArray.length but this would limit grid to square
// TODO --> div cell
//
//! Stretch Goals - Wed Lunch
// Animate Game Objects, add rotation depending on direction
// ? (possible needed for mpv) when moving, if nextCell is 'X' && currentDirection !== nextDirection && moveStatus === moving
//! Polishing - Thu Evening
//! DEMO MORNING - Friday Morning
}
//
//
//
// * Objects
//
const gameObjects = {
mapObj: {// * ObjName, isSolid, isEdible, isPermanent, canMove/speed? , color, behaviour,
wall: ['X',],
dot: '.',
empty: ' ',
},
bonusObj: {
fruit: [],
energigizers: '', // or PowerPellets - 4 placed approx in each corner,
},
ghostObj: {
name: 'Blinky', // Pinky, Inky, Clyde
color: 'Red', // pink, cyan, orange
behaviourType: 'Basic', // Basic is just random movement // will extend after MVP
},
}
const map = {
Name: 'name',
Width: 0, // ? Square or rectangular, how does this affect game mechanics/calculations?
cellArray: ['.', ' ', 'X'],
// * GamePlay Settings
Difficulty: 1, // ? 1-10?
playerStartPosition: 1, //(cellArray[?])
ghostStartPosition: 5,
}
//
//
//
//
//
//
//
//
// * JS FUNCTIONS
// ? Ghost Behaviour Types
// ? Check if can move
// ? check if LoseLife, addPoint, doNothing,
// TODO: Define movements and map to keyboard keys
if (gameStage !== 'stopped') {
}
//
//
//
//
//
//
//