How do I spawn a sprite on a parallaxed layer

Get help using Construct 2

Post » Tue Nov 29, 2016 10:32 am

Hi.
What I am trying to do, is to spawn a sprite (explosion decal) when the enemy dies on a parallaxed layer.
The parallaxed layer is the wall and the decal is the smoke effect that is impregnated on the wall.
The problem is that since the layer has parallax, the decal is not spawned in the point where the enemy dies.
Is it possible to solve this ? Thanks.

Here is a example I've made. The left side is about what I explained above:
https://www.dropbox.com/s/9djcgjkl23mb1 ... .capx?dl=0
B
38
S
10
G
9
Posts: 212
Reputation: 6,995

Post » Tue Nov 29, 2016 11:39 am

Change your:

Enemy|Spawn ExplosionDecal on layer("BG")
to
System|Create object ExplosionDecal on layer("BG") at (enemy.X + ViewportLeft(0) - ViewportLeft(1), enemy.Y + ViewportTop(0) - ViewportTop(1))

with the layer: BG
X-coordinates: enemy.X + ViewportLeft(0) - ViewportLeft(1)
Y-coordinates :enemy.Y + ViewportTop(0) - ViewportTop(1)

I think there a commands for that like CanvasToLayer or LayerToCanvas but I don't get it to work. Maybe someone with more experience can help with that commands.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Tue Nov 29, 2016 2:37 pm

You need to convert from your Player layer to the Canvas, then from the Canvas to the BG layer.

http://www.blackhornettechnologies.com/Construct2Stuff/EnemysDestroyedOnParallaxLayer_BHT.capx
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Tue Nov 29, 2016 3:43 pm

Ah, now it makes sense. Thanks @blackhornet for the explanation.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Tue Nov 29, 2016 9:33 pm

Thanks a lot guys !
B
38
S
10
G
9
Posts: 212
Reputation: 6,995


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 35 guests