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
35
S
9
G
9
Posts: 206
Reputation: 6,803

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
21
G
220
Posts: 3,646
Reputation: 123,721

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
35
S
9
G
9
Posts: 206
Reputation: 6,803


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 7 guests