So a couple of weeks ago I asked Casey to explain how I could add rotation to the particles during a pre stream. Unfortunately I don't have a copy of the prestream and I am having difficulty in working out how to go about this.
He explained the basics of rotating a point in 2d which I thought at the time made sense however I am having trouble trying to work out how this would fit in with the existing handmade hero render code base especially with the concept of the x and y axis.
For example, when drawing the particles in handmade hero we use push bitmap. I wanted to added some kind of rotation argument to this call which I then used before calling draw bitmap to rotate the x axis.
1 2 | Vector2 xAxis = { Cos(entry->Rot), Sin(entry->Rot) }; Vector2 yAxis = Perp(xAxis); |
However this just rotates the particles as a whole system around the lower left of the player which I assume is the origin.
So my question is how can I can rotation into this so I can rotate each particle independently around the particle centre?
The way Casey explained it was that we need to move what we want to rotate to the origin, and then rotate it before translating it back I am having a hard time actually implementing this in code.