Efficiently draw lines across a lot of points?

  • I have a lot of points, say (x_1,y_1), (x_2,y_2), ... up to (x_n,y_n). The task is to draw straight lines between each (x_k,y_k) and (x_k+1,y_k+1), each very close to each other.

    I am wondering if the two approach are equally efficient:

    1. Using sprite. Say I have a black sprite. I will just set each sprite having width distance(x_k,y_k,x_k+1,y_k+1) and angle(x_k,y_k,x_k+1,y_k+1) and height say 5.

    2. Using tiled background. Say I have a black tiled background. I will just set each tiled background having width distance(x_k,y_k,x_k+1,y_k+1) and angle(x_k,y_k,x_k+1,y_k+1) and height say 5.

    The two set sizes seem to be doing different things. The sprite set size is like scaling the sprite, while the tiled background set size is like cutting part of the tiled background (and pasting if the size is large). I am wondering if one of them is more efficient.

    Any insight will be appreciated. Thanks.

  • Hallo Wai,

    i dont know what your are working at, but I would suggest tiled backgrounds for the lines. If you use sprites and change their size, they will be stretched. Also they need more resources.

    Here is one way it can be done (.c3p): 1drv.ms/u/s!Ap_-qxoGKbDcaqooBUbXPbsF4dk

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don’t think there will be a measurable difference.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)