How do I draw trajectory from sprite

Get help using Construct 2

Post » Sun Aug 21, 2016 8:09 pm

Hi, how would you draw on screen, with a line, a trajectory from a moving sprite in Construct 2?

I would think to draw a 1px sprite every tick at sprite position, but using that much sprites sounds like not optimized at all ...

Do you think of any other way ? Even if it requires to write a plugin ?

Thanks for helping :-)
B
8
S
4
Posts: 131
Reputation: 1,205

Post » Sun Aug 21, 2016 10:17 pm

You could use the canvas or paster plugins to draw.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Tue Aug 23, 2016 12:15 am

sounds like an idea, thanks !

I guess this is it : plugin-paster_t88750
B
8
S
4
Posts: 131
Reputation: 1,205

Post » Tue Aug 23, 2016 7:39 pm

Those plugins are doing exactly what we asked for, especially Canvas.

But I'm using big layouts (3000~5000px) and it create a massive stuttering when drawing on such big canvas. (and I have a good computer ...)

Paster has no problem, though, but I can't draw a clean line with quads ... (maybe i'm wrong ?)

It has another problem : impossibility to delete the lines except if you clear the canvas.

In the end I switched back to particles ... It doesnt make lines but it can draw a path with dots ...
B
8
S
4
Posts: 131
Reputation: 1,205

Post » Thu Aug 25, 2016 2:15 am

The canvas plugin is slow when webgl is on.

With paster you can make a line with a quad, but it's easier to paste a sprite positioned like a line.

Both plugins are just something you can draw to. To be able to remove indavidual lines you need each line to be it's own object, and you can do that with sprites.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Thu Aug 25, 2016 3:38 am

Curved or straight trajectory? Straight you can just stretch a 1px tall line sprite as long as you need it, curved you can break it up into x pieces with some creative lerping.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Fri Aug 26, 2016 2:00 pm

the stretched pixel is a pretty good idea, actually ! Thanks !

I still need to learn how to use lerp beside that ;-)
B
8
S
4
Posts: 131
Reputation: 1,205


Return to How do I....?

Who is online

Users browsing this forum: evillair, Solomon, vankizzle and 6 guests