How do I make a counter

Just started using Construct 2? Post your questions here

Post » Tue Aug 19, 2014 12:52 am

What i have is coins, Gold and Silver. What i want is to touch one Gold coin, add 1 to the counter, touch 10 or so Silver coins, add one to the counter.

What i have is :

Player, on collision with GoldCoin: System, Add 1 To CoinCollect (Global Variable)
GoldCoin, Destroy
Text, Set text to round(CoinCollect) <--this works correctly

Player, on collision with SilverCoin: System, Add 1 To SilverCoin (Global Variable)
SilverCoin, Destroy

System, SilverCoin=10: System, Add 1 to CoinCollect (Global Variable) <--Figured this was my anwser but it wont add correct if i grab silver coins, it does like a hundred, but if i grab gold coins first, they add normal, but never add the 10=1 count.


my global variables are CoinCollect and SilverCoin =0 (Global number)

any help would be awesome :D
B
3
Posts: 6
Reputation: 177

Post » Tue Aug 19, 2014 1:04 am

make the silver coins add .1, and use floor(coincollect) instead of round for your text so it won't show partial coins.

No silvercoin variable necessary.

That's what I would do...
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Aug 19, 2014 1:11 am

Thank you will try :)
B
3
Posts: 6
Reputation: 177

Post » Tue Aug 19, 2014 1:15 am

Nope still doing the same,
B
3
Posts: 6
Reputation: 177

Post » Tue Aug 19, 2014 1:18 am

Here is my little project,
You do not have the required permissions to view the files attached to this post.
B
3
Posts: 6
Reputation: 177

Post » Tue Aug 19, 2014 1:25 am

silver coin > 10 will add 1 every tick while that is true. you don't want that at all.
you're also only updating the counter on collision with gold coins.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Aug 19, 2014 2:18 am

Player, on collision with SilverCoin:
System, add 0.1 to CoinCollect
SilerCoin, Destroy
Text, Set Text to floor,(CoinCollect)

You was correct, I didn't need the SilverCoin Variable .

Thanks a lot ;)
B
3
Posts: 6
Reputation: 177


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests