Skip to content
Sign upLog in
← Back to Community

monopoly python

Profile icon
minecraftmake55

what code would i use for when someone lands on a property that is owned take money from them https://repl.it/@minecraftmake55/halo-monopoly

Voters
Profile icon
AlieksandrLiens
Profile icon
minecraftmake55
Comments
hotnewtop
Profile icon
mwilki7

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): player1.money-=5 if (prop.ownedBy == player2): player2.money-=5

Also those are interesting names for some of your projects 😂

Profile icon
a5rocks

something like:

player.money -= 10 player2.money += 10

?