Coins count effect

Discussion and feedback on Construct 2

Post » 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
38
S
15
G
6
Posts: 238
Reputation: 7,760

Post » Fri Feb 17, 2012 7:11 pm

why dont you spawn the coin on the layer that uses the right paralax setting?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » 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
38
S
15
G
6
Posts: 238
Reputation: 7,760

Post » Fri Feb 17, 2012 7:36 pm

spray the coins using the particle system =]
ImageImageImageImageImageImage
B
93
S
20
G
14
Posts: 1,221
Reputation: 19,508

Post » Fri Feb 17, 2012 8:00 pm

@Vladoss
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
79
S
24
G
55
Posts: 4,755
Reputation: 41,273

Post » Fri Feb 17, 2012 8:03 pm

[QUOTE=R0J0hound] @Vladoss
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
38
S
15
G
6
Posts: 238
Reputation: 7,760


Return to Construct 2 General

Who is online

Users browsing this forum: armaldio, shinichild, zenox98 and 1 guest