Python Forum
[pygame] Inventory problems. Weapons equipped to wrong slot
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[pygame] Inventory problems. Weapons equipped to wrong slot
#2
Quote:
    def equipChange(self, receive, equips=None, n=None):
        if receive:
            return self.equips
        elif not receive:
            if n in self.availableSlots:
                equipsList = list(equips)
                if Counter(equipsList).most_common(1) == [(n, 2)]:
                    equipsList.remove(n)
                equipsTuple = tuple(equipsList)
                equ = 0
                equ2 = 0
                for eq in equipsTuple:
                    equ += eq
                for eq2 in self.equips:
                    equ2 += eq2
                if equ != equ2:
                    self.equips = equips
                else:
                    equipsList = list(equipsTuple)
                    equipsList.remove(n)
                    equipsTuple = tuple(equipsList)
                    self.equips = equipsTuple
        time.sleep(.5)

Help me to help you:
- what does receive mean?
- what's equips, and how is it different from self.equips?
- what's the equipsList for?
- what does this mean?
            equ = 0
            equ2 = 0
            for eq in equipsTuple:
                equ += eq
            for eq2 in self.equips:
                equ2 += eq2
            if equ != equ2:
                self.equips = equips
Reply


Messages In This Thread
RE: [pygame] Inventory problems. Weapons equipped to wrong slot - by nilamo - Apr-30-2019, 09:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  pygame installation problems Gheryk 5 8,930 Nov-29-2023, 08:49 PM
Last Post: E_Mohamed
  [PyGame] Problems with jump code in pygame Joningstone 4 5,587 Aug-23-2021, 08:23 PM
Last Post: deanhystad
  Adding an inventory and a combat system to a text based adventure game detkitten 2 7,159 Dec-17-2019, 03:40 AM
Last Post: detkitten
  [pygame] Inventory items not working SheeppOSU 14 7,208 May-27-2019, 09:44 PM
Last Post: metulburr
  [Pygame] Problems with my textbox SheeppOSU 1 3,216 May-27-2019, 12:03 AM
Last Post: metulburr
  [pygame] Blitting armor and weapons with inventory SheeppOSU 3 3,023 Apr-29-2019, 02:31 AM
Last Post: SheeppOSU
  [pygame] Equiping inventory slots with invisible buttons SheeppOSU 6 4,952 Apr-26-2019, 08:45 PM
Last Post: SheeppOSU
  drawing, moving, and collision problems (pygame) SheeppOSU 26 15,524 Apr-22-2019, 03:09 AM
Last Post: SheeppOSU
  Problems with loading buttons (pygame) SheeppOSU 2 3,277 Apr-12-2019, 08:04 PM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020