November 2017
Beginner to intermediate
398 pages
8h 42m
English
This component contains an image and a text that displays the current amount for either the food or health of the castle. Its position will change depending on this amount--it will go up as the amount diminishes and will go down when it replenishes.
We will need three props for this component:
We also need a computed property to calculate the vertical position of the bubble with the ratio prop. The position will range from 40 pixels to 260 pixels. So, the position value will be given by this expression:
(this.ratio * 220 + 40) * state.worldRatio ...
Read now
Unlock full access