How do I draw a line

Get help using Construct 2

Post » Wed May 21, 2014 10:21 am

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?
B
5
S
1
Posts: 23
Reputation: 471

Post » Wed May 21, 2014 10:27 am

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.
B
44
S
10
G
8
Posts: 437
Reputation: 6,473

Post » Wed May 21, 2014 10:28 am

Use a tiled background, and set the hotspot to Top-left (under object properties). This way it will stay in place.
B
20
S
5
G
4
Posts: 51
Reputation: 4,139

Post » Wed May 21, 2014 1:24 pm

Thanks, both of you! Tiled Bkg did the trick. ;-)
I forgot that x of sprite is centre.
B
5
S
1
Posts: 23
Reputation: 471


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests