How much does the performance of setRotation() take?

I have a plane that i want to strafe the player, aa gun. I am not a talented pixel artist but when trying to figure if i should set the plane rotation it looks really bad.

I want to use set rotation but not affect the performance, but how much performance does the setRotation() take?

It's take a bit, enough for it to be wasteful to do the same rotations over and over every time the angle changes.

You can be more savvy about it.

One approach would be to rotate all the angles you need at startup and either store them in memory for later use. Though even that is slightly wasteful as you could do the rotations once and write the resulting images to disk so you can create an imagetable of them for more normal loading.

Ok, what would be an efficient way to that, i saw your car game, love it keep it up, and i would do that but my friend and i are trying to make an space invaders, balloons td6 game where you shoot down enemy airplanes with an aa gun u crank. Should we render an animation of the plane doing a strafe attack as a sprite sheet?

Yes you should render it. I don't mean 3d but just doing the rotations once and storing the result.

You can use your game engine to spit out images if you already have it rotating there. Otherwise you can use a batch tool on desktop.

And thanks for the kind words!

Alrighty, i am using vs code and asesprite for my sprites. I'll look into that option. Asesprite rotation just absolutely devistates the sprite when rotating it.

You should try to using the RotSprite rotation alogorithm. I know Aseprite has it.

Pixaki 4.2 on iPad also supports it, since middle of 2021.

Pixel Studio on mobile also supports something similar.

1 Like

Ok will do thank you for all the help