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
47
S
11
G
10
Posts: 237
Reputation: 7,902

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
27
S
3
G
1
Posts: 500
Reputation: 2,355

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
72
S
22
G
290
Posts: 3,886
Reputation: 159,513

Post » Tue Nov 29, 2016 3:43 pm

Ah, now it makes sense. Thanks @blackhornet for the explanation.
B
27
S
3
G
1
Posts: 500
Reputation: 2,355

Post » Tue Nov 29, 2016 9:33 pm

Thanks a lot guys !
B
47
S
11
G
10
Posts: 237
Reputation: 7,902


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests