Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17063

Bullet Path Using bresenham Line Algorithm For Shooting Game

$
0
0

Hi Friends,

Could you please help modify the below line algorithm to plot only one pixel at a time to have a bullet path moving from a x1, y1 to x2, y2.   Here x1,y1 is the source and x2, y2 is the target and there values are predefined. No sin / cos calculation here.   

Bullet need not travel all the points calculated by the algorithm but jumping few x and y pixels for smooth movement.     

void DrawLine(int x1, int y1, int x2, int y2, unsigned char color)
{
 int i,dx,dy,sdx,sdy,dxabs,dyabs …


Viewing all articles
Browse latest Browse all 17063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>