Problem with weapon selection and tables.
Ok so I have 1 prototype actor and It uses a table to see whether it is purchased or not. I have set it up with a self attribute called SwordNumber, and in all parts of the code where it needs it's number I put that in instead (e.g. tableCellValue(game.store,self.SwordNumber,2))
I did this so I only need one actor, which I can copy easily onto the scene and only have to change the image, and the self attribute SwordNumber, according to what sword it is.
Another thing I should mention, is that it is part of a scrolling menu, (I followed tshirtbooth's tutorial on the Gamesalad Cookbook on YouTube Multiscreen menus part 1 and 2) so it detects whether the screen should scroll, or equip the weapon.
It is also set up that if the sword is equipped, it darkens in colour.
Here is my problem:
I can purchase the sword fine, but then after I have purchased it, it equips the newly purchased sword (Which is fine) but if I click on a different sword to click, it flickers (because I set it to darken when it is equipped) but it won't stay equipped. Sometimes when I click on a sword to try and equip it, a different sword flickers.
I know that you might need more information than this, but I tried to explain it as best as I could.
Please, if anyone might be able to help me fix this bug, it would be greatly appreciated.
I did this so I only need one actor, which I can copy easily onto the scene and only have to change the image, and the self attribute SwordNumber, according to what sword it is.
Another thing I should mention, is that it is part of a scrolling menu, (I followed tshirtbooth's tutorial on the Gamesalad Cookbook on YouTube Multiscreen menus part 1 and 2) so it detects whether the screen should scroll, or equip the weapon.
It is also set up that if the sword is equipped, it darkens in colour.
Here is my problem:
I can purchase the sword fine, but then after I have purchased it, it equips the newly purchased sword (Which is fine) but if I click on a different sword to click, it flickers (because I set it to darken when it is equipped) but it won't stay equipped. Sometimes when I click on a sword to try and equip it, a different sword flickers.
I know that you might need more information than this, but I tried to explain it as best as I could.
Please, if anyone might be able to help me fix this bug, it would be greatly appreciated.
Comments
When touch is pressed and if game.sword is not equal to self.SwordNumber
then change attribute game.sword to self.swordNumber
And here is the table, just in case:
And the "darker change attributes".
Put them in a seperate rule that says when game.sword=self.swordnumber
"Make it darker"
And then in the otherwise section you do.
"Make it normal"(change 0,5 back to 0)
This should work. I just can't see the second condition. Is it when game.released.x=game.touch.x
If it says so,try to delete it also because it's no reason for that.
Anyway, thanks for the help!