8. Where do I store my players health?
Inside the Player component, of course!
8
9. Where do I store my players health?
Inside the Player component, of course!
Where do I store the amount of damage can
caused by a bullet once it hits the player?
9
10. Where do I store my players health?
Inside the Player component, of course!
Where do I store the amount of damage can
caused by a bullet once it hits the player?
Inside the Bullet component!
10
11. 11
how neat and tidy their
health value is stored
internally.
12. 12
how neat and tidy their
health value is stored
internally.
what they see displayed in
the game UI and how the
actions are triggered
13. What if?
There is a great flashing animation for every time
the player’s health decreases?
There is a power-up you can collect that lets you
control another player for a period of time, showing
that player’s health instead of your own?
13
16. Reactive programming
Reactive programming is a declarative
programming paradigm concerned with data
streams and the propagation of change.
(Wikipedia)
Programming with asynchronous data streams
16
17. In reactive programming it’s all about programming
with data streams, streams of input data.
RP raises the level of abstraction of your code so
you can focus on the interdependence of events
that define the business logic.
17
27. 27
when an item is emitted by either of two Observables, combine the latest item
emitted by each Observable via a specified function and emit items based on the
results of this function
32. Identifying the source streams
● Navigate the bird using the keys
● Keep track of the player’s score
● Keep track of the player’s lives
● Keep track of the pipes on the field (includes
generating new pipes)
32
48. JavaScript is single-threaded.
Preventing the browser from doing anything so
that it locks up.
In other words, the browser may not be able to
process all these updates quickly enough.
48
49. The browser is trying to render a frame and then
it’s immediately asked to render the next one.
As a result, it drops the current one to keep up the
speed. That’s when animations start to look laggy.
49
55. A game, in programming terms, consists of an
infinite loop with the following steps:
● gather user input
● update the state of the game based on that
input
● draw everything
55
Final thoughts