Example: Rotating a Sequence Item

You can create a Sequence for a sword animation, and play it in-game. But, the animating sword cannot be easily rotated with the player.

GIF 0

(The player in the Sequence is later made invisible, so you don’t see two players)

One of the solutions for this is to use the Matrix Functions.

By changing the World Matrix in the Draw event of the sword, you can make it draw relative to the player. The matrix will handle the player’s rotation, and since the sword will be drawn relative to that, it’ll rotate with the player.

GIF 1

Of course, this only makes it draw in the correct position. This won’t fix collisions, although you can use the same matrix to transform the sword coordinates, and then calculate collisions at that position.

Download Project