|
8 directions |
neil dwyer
Member #7,237
May 2006
|
Why are there only eight directions? I am assuming it has something to do with allegro degrees and the player1_rotate. My bitmap will rotate all 255 degrees but if I press forward it will only go North, South, East, West, NE, NW, SE, or SW. Sorry for all of my noob questions but I am a noob. Do I have to do the trig in radians and the normal trig functions?
Thanks. |
gnolam
Member #2,030
March 2002
|
You're converting the results of sin and cos [-1, 1] into integers. Just dump all the fixed point and use floats like normal people already. -- |
neil dwyer
Member #7,237
May 2006
|
how many radians is one allegro degree. It's like 40 something but I want to be exact. |
Elverion
Member #6,239
September 2005
|
There are 2PI radians in a circle, or 256 Allegro degrees. That means there would be roughly 0.025 radians in 1 Allegro degree. I think the problem with there only being 8 directions is due to rounding. If you are using itofix, that means you are taking radians (which are float), and rounding them to ints. The loss of data would cause problems like what you had stated. -- |
neil dwyer
Member #7,237
May 2006
|
yes, but does it round to the nearest 16th whole number? |
Johan Halmén
Member #1,550
September 2001
|
player1_x and player1_y should be floats, not ints. And the thing you add to them should be float, not int. speed * fixtoi(fcos(itofix(player1_rotate))) turns into -1, 0 or 1. So when you add that to both x and y, you get only 8 directions. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
neil dwyer
Member #7,237
May 2006
|
ok |
|