Advertisement

Bad Direction

Started by July 10, 2000 05:21 PM
1 comment, last by kroiz 24 years, 5 months ago
hi i''m making a 2d tank game. i made a sprite with 32 iterations. i also made a look up table, but when i move the sprites some iterations move to the same direction as the one next to them. here is what i mean in numbers: when i debug this code: -------------------------------------------------------- vx = CosLookUp[CurrentFrame]; vy = SinLookUp[CurrentFrame]; xfactor = int(4 * vx); yfactor = int(4 * vy); ------------------------------------------------------- for CurrentFrame = 8 i get: vx = 0.999 vy = -0.034 and then: xfactor = 3 yfactor = 0 and for CurrentFrame = 9 i get: vx = 0.987 vy = 0.1564 and then: xfactor = 3 yfactor = 0 as u can see i get the same xfactor and yfactor for different CurrentFrame. hope u dig. tnx very much for your time and for trying to help.
0 error(s), 0 warning(s)
It is a simple rounding error. The differense between the two angles are so small, that when converted to screen coordinates the result will be the same for both of them. You could reduce the number of frames. Or increase the movement factor (4). BUt that would mean that the tank moved faster.


Snale
+--Java Game
Advertisement
quote: Original post by Snale

Snale
+--Java Game


fix the link in your signature, it leads to the wrong address
instead of www.snale.f2s.com it has to be http://www.snale.f2s.com . otherwise the web browser thinks it''s a relative address as opposed to the direct address so it sends me to some nonexistent page

----------------
- Pouya / FOO!!!
***CENSORED***

This topic is closed to new replies.

Advertisement