OK I plan to list some usefull math to help make pixel art.
-Play along it's more text than trouble.-
This formula will find a point a given distance and direction away from a base point.
startx= the starting pointx
starty= the starting pointy
radius= the distance away you want the new point
ok now we have to fid the new points x and y
endx=basex+cos(angle)*radius
endy=basey+sin(angle)*radius
Why would you use this you ask? Well lets say you have objects you want arranged in a circle around a central point, now you simply incriment the angles and use the same starting point and you have evenly spaced objects.
Also you can use this to make PERFECT iso circles you simply use the radius/2 for the y radius.
Lets try it out and see how it works.
Ok we have a pixel ar (12,3) and we want to put a planet at a 45 degree angle away from it with a radius of 24 pixels.
Ok we know our base point x and y
basex=12
basey=3
radius=24
angle= 45
endx=basex+cos(angle)*radius - this will find the new x coordinate
endy=basey+sin(angle)*radius - this will find the new y coordinate
endx=12+cos(45)*24 = 28.97 rounded to 29 *note never truncate
endy=3+sin(45)*24 = 19.97 rounded to 20
Hope it helps! I'll have more soon.
this could be used to make perfect triangles and other ngons by using more than one angle.
Lets say we want to make a perfect triangle.
We would use the angles 0,120,240 and our base point would reside in the middle. If we want to rotate the direction of the triangle we simply add the same rotation angle to all of the angles. If you want to rotate your triangle 10 degrees the angles for the formula would be (10,130,250).
You use the same base point for basex and basey, you only change the angle variable. If you are willing to spend the time you can get breat results.
It gets a bit more diffcult when you are working with even widths as they have no central point, you have to use the four points that form the middle "cluster".
------------- http://www.shmup-dev.com/forum/">
|