How do I draw a line

0 favourites
  • 4 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • I need a time progress bar, a red line which reduces its length every second.

    I searched in vain for a Draw function, so can anybody help.

    I tried to make a line sprite and decrease width, which works, but it won´t stay in place, even if i did this:

    Timeline sprite is at start 900 pixels wide and TimeLeft starts at 300.

    Do every second

    Timeline.width = TimeLeft*3

    Timeline.X = 675 (which should keep it in place, but it still shortens at both ends)

    Drawing a line every Tick would do the trick, I think.

    Anybody?

  • the x position of an image should not change, if you don't change it in any of your events. Only thing I can imagine here is, that you placed the image on a layer with paralax. So while you are moving, it looks like that the line is moving but the whole layer is moving. To get rid of this is by placing that image on a separate layer that is just as big as the screen with no paralax.

    In regards of drawing a line, you can use the canvas plugin to do this, don't know of another way.

  • Use a tiled background, and set the hotspot to Top-left (under object properties). This way it will stay in place.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, both of you! Tiled Bkg did the trick.

    I forgot that x of sprite is centre.

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