Ask coding questions

← Back to all posts
monopoly python
minecraftmake55 (5)

what code would i use for when someone lands on a property that is owned take money from them

mwilki7 (1112)

Am I understanding your question properly if I word it like this?
How do I take money from the owner of land?

I'm not too familiar with the rules of monopoly but you will need more information about the property to be able to tell if a player owns it or not (unless standing on the same spot is enough to own it).

Maybe add another field to your "property" class
this.ownedBy = playerName
or something along those lines

Then perform a loop on the "Propertys" array:

for prop in properties:
    if (prop.ownedBy == player1):
    if (prop.ownedBy == player2):

Also those are interesting names for some of your projects 😂

a5rocks (801)

something like: -= 10 += 10