• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Line drawing and vertex drawing twitching on me

tagwolf

Member
I keep getting twitching on some lines of the hexagons I'm drawing. I'm not sure if it's my code or if it's the function itself. I also tried putting in an angle reset back to 0 if that was the issue. It seems more stable in some cases if I let the angle climb forward (but I really don't want to do that)

I know my code isn't great right now, I'm doing basic testing first before refactoring but if you see an issue let me know. Thanks!

I've tried both draw_line and draw_vertex with the same results

create
Code:
sides = 6;
sidelength = 64;
angle = 360/sides;

newangle = 0;
newx = x;
newy = y;
draw
Code:
draw_primitive_begin(pr_linestrip)
repeat(sides + 1)
{
   if newangle >= 360 {newangle = 0;}
   if angle >= 360 {angle = 0;}
   newangle += angle;
   oldx = newx;
   newx = oldx - lengthdir_x(sidelength, newangle);
   oldy = newy;
   newy = oldy + lengthdir_y(sidelength, newangle);
   draw_vertex(oldx,oldy);
}
draw_primitive_end();


/*
newangle = 0;
newx = x;
newy = y;
*/
/*
repeat(sides)
{
   newangle += angle;
   oldx = newx;
   newx = oldx - lengthdir_x(sidelength, newangle);
   oldy = newy;
   newy = oldy + lengthdir_y(sidelength, newangle);
   draw_line(oldx,oldy,newx,newy);
}
*/
 
Top