Actions
As we mentioned before, only three Redux actions will be available:
tick()
: To calculate the next position of the sprites on the screenbounce()
: To make the parrot fly upstart()
: To initialize the game variables
This means our src/actions/index.js
file should be very simple:
/*** src/actions/index.js ***/ export function start() { return { type: "START" }; } export function tick(elapsedTime) { return { type: "TICK", elapsedTime }; } export function bounce() { return { type: "BOUNCE" }; }
Only the tick()
action needs to pass a payload: the time it passed since the last frame.