I have a game that uses filmstrips as frames for ship rotation. Let us say there are 180 'ship images' in one film strip. (aka 360 degrees at 2 degrees per frame).. Let us also say that FRAME 0 would be the ship nose pointing upwards.
I've recently changed it so that ship can be 'faster' then the amount of frames, which in turn works fine, but I want it to start on a angle that would actually HIT frame 0. What I mean is:
If I have a ship thats rotation speed of is at 1, it would have 180 rotations (or 180 frames).. Lets say I change ship while my original ship is sitting on is on frame 7. Let us say the new ship has a rotation speed of 0.5, or 90 rotations out of the 180 rotations it has. So this would mean its skipping a frame per rotation, aka two rotations per frame. Since the frame is preserved at frame 7, it would NEVER hit frame 0.
I was thinking of having it adjust itself to the nearest even number, so it would be wither 6 or 8 in this scenario, but this won't work becuase if the rotation rate i 0.25, or 45 frames, this would mean that it could potentially be a even OR odd number, aka skipping 3 frames now, 0 3 6 9 12 15 .. etc.
I didn't want to reset it to 0 all the time because it looks weird when it is reset completely, of course.
I apologies if it doesn't make sense, what I'm trying to state is I want the closest lowest number depending on the multipler, that would actually 'hit' the number '0'. Here would be a simple math example I suppose:
So if I had a number of 7 and a multiplier of 3, the number it would move too would be either 6 (0 3 6)...
If I had a number of 15, and a multiplier of 4, the number it would move too would be 12. (0 4 8 12)..
If I had a number of 6, and a multiplier of 2, the number wouldn't change of course, since its already on a number that works to become 0. (0 2 4 6)...
If had a number of 3 and a multipier of 5, the number would end up being 0. etc
I hope this explains it a bit!