How do I make upgrades add more than 1 to variable.

Get help using Construct 2

Post » Fri Oct 14, 2016 2:13 pm

Basically I am still learning and would like to create a guide for my self.

Lets say I have a sprite called (egg) if I click on (egg) it adds 1 egg to the global variable or local variable (whichever one will work for this)

After I have 10 eggs I can buy my second sprite (chicken) which would add 1 egg per second to my global or local variable.

Now my problem is that even if i buy 10 chickens I am only still receiving 1 egg per second instead of 10.

How can I change that so that I get more eggs per second.

I have tried the "for each" but cannot select variables only sprites.
B
3
Posts: 5
Reputation: 185

Post » Fri Oct 14, 2016 2:56 pm

Instead of adding 1 to egg add chicken 'count' to egg
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Fri Oct 14, 2016 3:06 pm

badmoodtaylor wrote:Instead of adding 1 to egg add chicken 'count' to egg


Not sure what you mean by this. Sorry I am a complete noob.
B
3
Posts: 5
Reputation: 185

Post » Fri Oct 14, 2016 3:12 pm

Asmir13 wrote:Now my problem is that even if i buy 10 chickens I am only still receiving 1 egg per second instead of 10.


For this, right now you probably have "add 1 to eggs", where you clicked on "add to" and when the field popped up you left it as 1.

Instead of adding 1 to eggs you want to add 1 egg per chicken, correct? So add the number of chickens to the number of eggs. If chickens is already a variable somewhere just put the variable in the field. If chickens are sprites then use the count expression which will count the number of instances in the project of chickens (so be wary of ones off the screen and such). Can't remember if the expression is chickens.count or count("chickens")...
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Fri Oct 14, 2016 3:19 pm

Worked like a charm. My brain stopped working and I only figured I could use numbers instead of other variables. Thank you very much sir.
B
3
Posts: 5
Reputation: 185

Post » Fri Oct 14, 2016 3:35 pm

Asmir13 wrote:Worked like a charm. My brain stopped working and I only figured I could use numbers instead of other variables. Thank you very much sir.


You are welcome. Any field like that you can use any variable or expression
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913


Return to How do I....?

Who is online

Users browsing this forum: Sparkz and 3 guests