Author Topic: Coin play - Credits not updating for multiplayer  (Read 1280 times)

Frank Gigliotti

  • Wizard
  • *****
  • Posts: 174
  • Wrath of Olympus Dev Team
    • View Profile
Coin play - Credits not updating for multiplayer
« on: April 08, 2015, 10:03:44 AM »
I added coin play to our game and everything displays as it should for single player, but the self.game.credits does not get updated for multiplayer. I checked the variable is getting incremented/decremented but in the scoredisplay.py its not refreshing the footer layer.

Here is the bit of code I added to scoredisplay.py

      # Common: Add the "BALL X ... FREE PLAY" footer.
      common = dmd.TextLayer(128/2, 32-6, self.font_common, "center")
                if self.game.tournament == True:
                        credit_str = 'COMPETITION'
                else:
                        #4-7-15 added coinplay and credits
                        if self.game.coinplay == 'Enabled':
                                credit_str = 'CREDITS ' + str(self.game.credits)
                        else:
                                credit_str = 'FREE PLAY'

when another player is added, self.update_layer_4p() is called, another player score is added to the screen,
it decrements self.game.credits, but the credits on the display remain the same. So the BALL X footer is not getting updated.
credit_str is in the common layer. I tried to update the common layer before calling the update_layer_4p and the credits still remain unchanged.

What am I missing?

Frank Gigliotti

  • Wizard
  • *****
  • Posts: 174
  • Wrath of Olympus Dev Team
    • View Profile
Re: Coin play - Credits not updating for multiplayer
« Reply #1 on: April 08, 2015, 01:20:40 PM »
ok, I figured it out. The scoredisplay was looking at self.game.credits when the multiplayer section of my code incremented/decremented self.credits. Doh!!!! It works now :)

MOcean

  • P3 Developers
  • *
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: Coin play - Credits not updating for multiplayer
« Reply #2 on: April 08, 2015, 02:04:02 PM »
Also it looks like score_display supports setting a credits callback function that would return a string to be used as the credits string, if set. You could probably move this out if the score_display to return to an unhacked state.