Question about equation's game

Get help using Construct 2

Post » Thu Oct 03, 2013 5:58 pm

In a game about equations, I intend to create multiple objects with random numbers from 1 to 9, which must be clicked together to equate to a value. Initially I think working with a single object with nine frames and 32 will be created from it. I thought first randomly generate this amount, but will always remain balls because you may not have numbers together to reach this value. The right would generate a value according to the spheres that have on the screen, but how can I do to know how much each is worth, whether they are copies of the same object? Does anyone have another idea or suggestion?RenatoB2013-10-03 17:59:12
B
74
S
13
G
3
Posts: 995
Reputation: 7,531

Post » Thu Oct 03, 2013 6:39 pm

Uh, I think I understand...

You can use "count" to know how many instances of an object there are.
I would create a random number between 1 and the sprite.count, for the first number, the second would be a number from 1 to the sprite.count minus the first number, then split it again, or use the remainder as the last number.
B
226
S
60
G
33
Posts: 902
Reputation: 39,989

Post » Thu Oct 03, 2013 8:05 pm

A little complicated for me. I think that I don't understand how to use "count". I'll know the value for each instance too? Something like "count.object.AnimationFrame" (I know this is wrong and maybe not exist - is only a guess). If is possible, maybe I could generate a total value based on the sum of the value of the remaining instances, according to a minimum of instances (eg 03).

Could you explain with details this solution that you suggested?

PS.I forgot to mention that there is an object on top of the spheres and the goal is to avoid it touch the floor.RenatoB2013-10-03 20:16:58
B
74
S
13
G
3
Posts: 995
Reputation: 7,531

Post » Thu Oct 03, 2013 8:36 pm

@RenatoB
The count expression is accessed by sprite.count
B
26
S
8
G
2
Posts: 33
Reputation: 3,645

Post » Fri Oct 04, 2013 11:52 am

I need to know if "count" will count the instances and values ??of each. If this is possible, I want to count how many instances there are currently screen, then randomly select two or three and add their values ??to associate it to the total.

Could a good soul give me a small example? No need to create a CAPX.

ThanksRenatoB2013-10-04 13:30:08
B
74
S
13
G
3
Posts: 995
Reputation: 7,531

Post » Fri Oct 04, 2013 5:23 pm

@RenatoB
You could do something like this.
For each object
is object on screen
     use the array push action to add the object's UID

Select a random value with round(random(array.length))


Pick object by UID
    

To pick more than one, use the pop action to remove the one already selected and then select another random value from the array.
B
26
S
8
G
2
Posts: 33
Reputation: 3,645

Post » Fri Oct 04, 2013 5:42 pm

Thanks @aerirprown, but my game is almost ready and I did't use "array". And about "count"? Could I use it to solve my problem? Thanks
B
74
S
13
G
3
Posts: 995
Reputation: 7,531

Post » Fri Oct 04, 2013 5:54 pm

There may be some other method that would involve count. I did not see a need for it to simply pick instances on screen.
B
26
S
8
G
2
Posts: 33
Reputation: 3,645

Post » Fri Oct 04, 2013 8:42 pm

@aerirprown

I don't know how to use array. I would like a simple solution (without array) and I thought that "count" would be a good the solution.
B
74
S
13
G
3
Posts: 995
Reputation: 7,531

Post » Sat Oct 05, 2013 6:45 pm

Any help?
B
74
S
13
G
3
Posts: 995
Reputation: 7,531

Next

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], JarkeyBacon, Shoda and 6 guests