multiply a number by a variable

Get help using Construct 2

Post » Wed Oct 16, 2013 8:09 pm


I am trying to multiply a number by a variable's number.

var(AcornCount)

When the player collides with HomeTree(sprite)
Acorncount(var) x 2
--------------------------------------
this is what I have under System

ADD(AcornCount * 100) to GameScore

http://www.dwbailey.com/images/ReturnScore.capx
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Wed Oct 16, 2013 8:15 pm

I tried viewing your capx but you're using a plugin I don't have and I'm not too keen on downloading a third party plugins that I'll never use.

However, you should be able to multiply variables simply by doing what you just did. What is the result that you're getting?
B
95
S
35
G
8
Posts: 315
Reputation: 11,326

Post » Wed Oct 16, 2013 8:20 pm

Yeah that's right (though you don't really need the parentheses). But you're setting AcornCount to 0 just before you multiply it by 100.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Wed Oct 16, 2013 8:36 pm

how do I check what 3rd party apps that I am using?
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Wed Oct 16, 2013 8:48 pm

http://www.dwbailey.com/images/multiplying.capx

I toggled off setting the value to 0 and it still doesnt add my my main score...not sure why.snake850272013-10-16 20:48:46
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Wed Oct 16, 2013 10:26 pm

any ideas
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Wed Oct 16, 2013 11:08 pm

The plugin you're using is Time Manager, which prevents me from opening it as well. Perhaps take a screenshot of the section of the event sheet you're dealing with?
B
14
S
6
G
1
Posts: 143
Reputation: 1,800

Post » Wed Oct 16, 2013 11:33 pm

http://s93.photobucket.com/user/spawn85027/media/morepoints_zps742e8400.jpg.html

its the line code at 33...trying to add 200 points to gamescore upon collision

do people often put things into plugins that are harmful or something?
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Thu Oct 17, 2013 3:38 am

?
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Thu Oct 17, 2013 3:58 am

Other than the set AcornCount=0 comes before you * 100. The rest is correct.
You just have to update your GameScore.text every tick instead of on collision with AcornRewards.

Is this what you want?
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 39 guests