I created a game of addition. The user has to add multiple objects with numbers to make the result equal to that shown in a panel. Each time the sum beats, objects are destroyed on the screen. Everything is OK until reach the last 3 objects on the screen, when the result must be the sum of the remaining objects.
I used the code bellow (but not worked):
System> objects <or = 3
�������� Pick all objects
�������� is on-screen objects
��������������� System> For each object: System> add to objetos.AnimationFrame to numPanel
How can I fix it? Thanks.
No one to help?
Anyway, which result does this code give back (which value does numpanel have and which numbers are present)?
RenatoB, do you have a capx you can share?
mindfaQ: Sorry for my mistake. With regards to the game, the code typically randomly chooses an amount of objects (1 to 5), sum the corresponding values ??and then displays the result in the panel. The player can choose these same objects or others with different values ??but the sum result must have the same that appears in the panel. When the sum is OK, clicked the objects are destroyed. The problem happens in the end to catch the value of the remaining objects (03 or less) and show this value in panel for the player click in these objects for to go to the next level.
Wastrel: Unfortunately I can't provide the file because it is already the final project with images and sound files. Sorry for that.
Yeah I've understood that, but was asking which value the panel shows when you are at your last 1-3 pieces.
The total of the values ??corresponding of the remaining objects.
Maybe I wasn't clear befor, so I decided to post an image of the code that determines what is displayed in the result panel (sorteio textfield).
I was asking which number then panel is showing when you are at your last pieces and which numbers the pieces carry...
Each object has a number 1-9. For example, if 4 objects left over at the end, the first with the number 5, the other two with the number 1 and the last with the number 8, the value that should appear in the panel shall be the sum of the value of these four objects: 15. Thus the player will be able to destroy all the objects and complete the level.
Do you need any more information about the code?
Develop games in your browser. Powerful, performant & highly capable.
To solve a problem it is nice to know what the problem is.
You have made very clear what you want to happen, but not what is happening.
So the question remains, when your program is running, what is the text showing?
I understand it's not showing what you want it to show, but to know where the problem is, it is necessary to know what the problem is exactly.
The panel shows a different value than the sum of the values ??that appear in the remaining objects. Also this value never repeat.
So what is the value it shows and what are the numbers on screen?
Maybe you could make a list of different situations to see if there is any logic in the wrong numbers, so it is easier to see where the problem actually is.