math validating

Get help using Construct 2

Post » Wed Jul 31, 2013 8:25 am

hi,
i have a problem in my program. in my project i have wanted number(text) and the values are changing randomly. and down side i have few sprite images with same name and changing that also changing randomly and working fine.but my problem is the according to the down side numbers the wanted total has to come, because the wanted total 1st and 2nd random variables are having numbers to count.but for last numbers are validating. can any one help me please.

https://www.dropbox.com/s/fnviyqpwc52troi/demo_num.capx
B
5
S
2
Posts: 91
Reputation: 738

Post » Wed Jul 31, 2013 9:18 am

Hi Narasimha.

I am trying to figure out what your problems is. But i am having a hard time understanding what it is.

You ask for a "WantedTotal" and you show a "Current" value. You can then click on the sprite numbers to try and get the "wantedtotal".

That seems to work for you. So what is the problem you want to solve?
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Wed Jul 31, 2013 10:10 am

hi @cvp

   my wanted total and sprite number is working fine.but my autual problem is the last sprite numbers are not having the proper wanted total and for me upto the last sprite number the Wnated total has to come like countable.

Ex:suppose if last sprite number having 9 the wanted total also has to be 9 , but for me it's coming like some other number. please share your ideas.
B
5
S
2
Posts: 91
Reputation: 738

Post » Wed Jul 31, 2013 10:12 am

ahh.. ok.

So the problem is that the wantedTotal asked for a number that is not possible to make?
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Wed Jul 31, 2013 10:14 am

yes @cvp
B
5
S
2
Posts: 91
Reputation: 738

Post » Wed Jul 31, 2013 10:38 am

Ok

I dont have time to make you an example right now. If you cant figure it out yourself I can make an example for your tonight.

But my approach would be:
Instead of creating the wantedTotal from a random number. Create the number from the numbers you have available on the sprites in the bottom. So pick 1,2 or 3(depending on how you want it) random numbers from the sprites in the bottom and them add them together to get a new wantedTotal
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Wed Jul 31, 2013 10:45 am

thanks @cvp.

   Now i'll go with your idea .i'll try it now.if possible for you send the example. thanks
B
5
S
2
Posts: 91
Reputation: 738

Post » Wed Jul 31, 2013 12:53 pm

I made an example.

It might not be the most pretty example, but as far as i can tell it works

.capx
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Wed Jul 31, 2013 3:17 pm

Thanks @cvp


in your example , you have taken local variable v=2, can you explain me what does it mean.narasimha2013-07-31 15:26:03
B
5
S
2
Posts: 91
Reputation: 738

Post » Wed Jul 31, 2013 4:01 pm

V is just a simple counter variable.

It is set to 2 as that is the number of sprites in the bottom it adds together to make the wantedTotal.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Next

Return to How do I....?

Who is online

Users browsing this forum: GabrielBalas, imhotep22, whitephon and 4 guests