# Coins count effect

Discussion and feedback on Construct 2

### » Fri Feb 17, 2012 6:58 pm

I think that all of you have seen this effect in a platformer games.
When player touches the coin, it begins to move the coin's counter.

So i tried to make something like this and it didn't work %(

Here is my events:

The problem is that when player contact with the coin, this coin is removed and new one created on layer "interface" in which parallax = 0.

So i need way to express coins coordinates relative to the "interface" layer.
B
39
S
17
G
6
Posts: 238
Reputation: 8,045

### » Fri Feb 17, 2012 7:11 pm

why dont you spawn the coin on the layer that uses the right paralax setting?
B
44
S
24
G
13
Posts: 723
Reputation: 15,095

### » Fri Feb 17, 2012 7:23 pm

[QUOTE=Weishaupt] why dont you spawn the coin on the layer that uses the right paralax setting?[/QUOTE]

What do you mean "right paralax setting"?
B
39
S
17
G
6
Posts: 238
Reputation: 8,045

### » Fri Feb 17, 2012 7:36 pm

spray the coins using the particle system =]
B
109
S
24
G
18
Posts: 1,388
Reputation: 22,951

### » Fri Feb 17, 2012 8:00 pm

Instead of destroying and re-creating the coin you can just use the "move to layer" action.

Then here is the math you're looking for to move the coin to a location on the parallax 0,0 layer that is visually the same as the scrolling layout.

coin | set position to (self.X-scrollx+WindowWidth/2, self.Y-scrolly+WindowHeight/2)
B
97
S
36
G
131
Posts: 5,513
Reputation: 83,464

### » Fri Feb 17, 2012 8:03 pm

Instead of destroying and re-creating the coin you can just use the "move to layer" action.

Then here is the math you're looking for to move the coin to a location on the parallax 0,0 layer that is visually the same as the scrolling layout.

coin | set position to (self.X-scrollx+WindowWidth/2, self.Y-scrolly+WindowHeight/2)[/QUOTE]

That's exactly what I needed! Thank you!
B
39
S
17
G
6
Posts: 238
Reputation: 8,045