Attribute is being added when it isn't supposed to be
Hello everyone,
I am getting frustrated because earlier my game (example) was doing exactly what I wanted it to. When a user clicks on an answer if it is correct it will increase the correct score. If it is wrong it will increase the wrong score. Simple. It was doing just that (or at least I can't remember it not doing that when I previewed it). Now, when I click on the right answer it will increase both the correct and wrong score attributes. However, if it is wrong it will only increase the wrong score. I have stared at this logic for awhile trying to figure out what is happening. I redid my table from scratch, and redid my rules. It stayed doing it.
Attributes:
correctScore (real)
wrongScore (real)
QN (question number) (integer)
compare (text)
table1 (5x5)
rule on answer 1
{ when touch is pressed
change attribute compare to tablecellvalue(table1, QN, 5) -------- column 5 is the correct answer column
rule
if compare is tablecellvalue(table1, QN, 1)
do: change attribute correctScore to correctScore +1
else: change attribute wrongScore to wrongScore +1
remove row at index QN
change attribute QN to random(1, (tablerowcount(table1))
}
Again, not too sure why it would increase the correctScore and wrongScore if the answer is right, but then just the wrongScore if the answer is wrong.
Comments
One possibility is that you unlocked the actor in the scene and created an "instance" with unique rules from the original "prototype."
I don't see anything wrong with your logic but to be sure, you may want to post a screenshot. Beyond that, I would recommend turning off rules one by one (make a separate backup of the file before you start messing with it) to see which rule is causing the problem. You can do that with individual behaviors as well. For example, you might check to see what happens when you turn off one or both of the change attribute behaviors that change the values of correctScore and wrongScore.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User