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.

Comments

  • FajlajpFajlajp Member Posts: 666
    How is your equip rule?
  • MattcusMattcus Member Posts: 85
    I'm not at my computer at the moment, so I can't check, However I am fairly certain that it is something like:

    When touch is pressed and if game.sword is not equal to self.SwordNumber
    then change attribute game.sword to self.swordNumber
  • FajlajpFajlajp Member Posts: 666
    Could you (when you have acsess to your computer) post some pictures of your rules?
  • MattcusMattcus Member Posts: 85
    Here is the code for the sword actor:
    image

    image

    image

    And here is the table, just in case:

    image
  • MattcusMattcus Member Posts: 85
    Is anyone able to think of what the problem might be?
  • FajlajpFajlajp Member Posts: 666
    Instead of when touch is released use when touch is pressed.
    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.
  • MattcusMattcus Member Posts: 85
    Thank you, it's all fixed now. I had when touch is released and when game.releasex=game.touchx because I didn't want players to accidentally equip a sword, when they wanted to scroll. However it is not that big of a deal, because they can easily change sword again, and the buy button, works properly.
    Anyway, thanks for the help!
  • FajlajpFajlajp Member Posts: 666
    I'm glad I could help :)
Sign In or Register to comment.