Game Development Reference
In-Depth Information
The texture we will use is aligned towards the top left corner, we will have to rotate the
sprite to compensate for this; we will rotate it by 3π/4 to align it towards the bottom.
Figure 64 - Rotating the damage indicator sprite to align the arcs towards the center.
We will add the angles Ɵ+δ to obtain the final rotation angle for our sprite. If we were to
draw the sprite on the center of the screen using the center of the sprite as its pivot, we
would see it properly aligned in the direction from where damage occurred, but it would
not be clear, and if we receive multiple damage events, the sprites would overlap.
To solve this problem we will use an ellipse, we will create it so that it fits nicely within
the viewport, then using the direction vector v' we can calculate a point on the ellipse, we
translate the sprite to this point and we will have the result we want.
Search WWH ::




Custom Search