-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpuck.js
More file actions
32 lines (30 loc) · 712 Bytes
/
puck.js
File metadata and controls
32 lines (30 loc) · 712 Bytes
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
import { MOVE_PUCK } from '../actions/puck'
import { PUCK_HAS_RESET } from '../actions/puck'
import { WIDTH, HEIGHT } from "../components/PlayingFieldContainer";
const puck = {
positionX: WIDTH / 2,
positionY: HEIGHT / 2,
mass: 15,
velocityX: 0,
velocityY: 0,
frictionX: 1,
frictionY: 1,
acceleration: 1,
puckSize: 25,
};
export default (state = puck, action = {}) => {
switch (action.type) {
case MOVE_PUCK:
return {
...state,
...action.payload
}
case PUCK_HAS_RESET:
return {
...state,
...action.payload
}
default:
return state;
}
}