How do I make "trails"?

Get help using Construct 2

Post » Tue Nov 17, 2015 11:33 am

hi to everyone :D

how can i make this effect, "trail" when a sprite is moving ?
Image


thanks
B
39
S
16
G
7
Posts: 1,727
Reputation: 9,865

Post » Tue Nov 17, 2015 12:22 pm

Have you tried searching the forum?
I'm sure I've heard this question before..
You can probably even find it in the FAQ-thread..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Nov 17, 2015 5:32 pm

I used a particle emitter pinned to the player sprite.
B
7
Posts: 12
Reputation: 329

Post » Tue Nov 17, 2015 7:13 pm

A trail exactly like that... I don't think is possible. Maybe with a lot of work or some 3rd party plugin I haven't heard of...

But the solutions above are viable for creating a trail
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Tue Nov 17, 2015 7:49 pm

To make it smooth like that you need to create sprites in the in between locations so it looks smooth. But that can be a lot of objects for a long trail so you'll probably want to tweak it to a point it looks good enough and is still fast.

/examples30/smooth_trail.capx
https://www.dropbox.com/s/d3711s0s2zhty ... .capx?dl=1
Last edited by R0J0hound on Fri Aug 18, 2017 5:25 pm, edited 1 time in total.
B
94
S
33
G
113
Posts: 5,353
Reputation: 73,267

Post » Wed Nov 18, 2015 9:15 am

well its ressource intensive, it is possible to "draw" colors pixels instead of creating objects, i have 239 objects created for 1 moving sprite, if i have 10 sprites in my screen....i can easily imagie the low performance of my Android.
B
39
S
16
G
7
Posts: 1,727
Reputation: 9,865

Post » Wed Nov 18, 2015 11:16 am

That's why you should tweak it..

In the example @R0j0hound posted changing RES to a higher number will reduce the amount of sprites created..
I'd disable collisions for sprite2 in it's properties if you are never going to use them..
You could fade out faster so the tail is shorter..

All these things can reduce the impact it has on performance..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jun 10, 2016 2:32 pm

R0J0hound wrote:To make it smooth like that you need to create sprites in the in between locations so it looks smooth. But that can be a lot of objects for a long trail so you'll probably want to tweak it to a point it looks good enough and is still fast.

https://dl.dropboxusercontent.com/u/542 ... trail.capx


thanks for this.. it helped me.. I was already doing this to some degree, but your approach helped me see it from a different perspective.

Since I'm applying the trail to a "bullet" from a weapon, I have to do a For Each and I'm worried about performance. Probably won't be more than 8 bullets on the screen at once.. I'm trying to keep each bullet with about 10-12 "trail objects"..
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Fri Jun 10, 2016 3:06 pm

@R0J0hound I am getting an "artifact" because I am spawning the bullet on every Space Bar press... that first iteration of oldx and oldy is set to 0. How do I init those variables to be the current X/Y before the Every Tick?

EDIT: answered my own question.... I set them to the current X/Y on the Trigger Event OnCreated... works... thanks!!
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Sat Aug 13, 2016 2:25 pm

Do this work for Particles effects? Or just Sprite Objects only?
B
13
S
1
Posts: 63
Reputation: 719

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests