straight line movement
I''ve read a little figuring out the line between any two points in 2d space.. but im not sure how to apply this, because I must move objects in integral amounts, generally 1 pixel, rather than fractional amounts, can you guy give me any help?
Keep all your data in floats and typecast them to ints when it comes time to draw your objects.
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Formats______________________________________________________________________________________
The Bresenham algorithm is the classic algorithm for generating per-pixel positions along a line between two points in 2D space,
.
There are a great many web references to this, including source code, and any search engine will turn up some leads if you just search on "Bresenham" and "line".
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

There are a great many web references to this, including source code, and any search engine will turn up some leads if you just search on "Bresenham" and "line".
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement