#πŸ”’ Guy I want to calculate coin

8 messages Β· Page 1 of 1 (latest)

hasty meteor
#

I want to make a game for my fun but had some issue to calculate coin:
Problem is the coin in the first class:
I can't calculate coin and save it to this class. Pls fix it for me (I'm a beginer)

class Player_data_infomation:
def init(self,hp,armor, coin,inventory):
self.hp =hp
self.armor =armor
self.coin =coin #<<this is coin
self.invertory =inventory.split()

player_data =Player_data_infomation(100,0,0,"wip") #<<player
text_startgame =["discord limit word issues"]
text_ingame =["same as text_startgame"]
import random as r
shop_item =r.choice(Game_data.item)
shop_weapon =r.choice(Game_data.weapon)
class shop_script(Player_data_infomation):

#calculate coin:

def shop_items():
try:
while player_data.coin < 0:
if "" in shop_item:
player_data.coin -= 60
if "" in shop_item:
player_data.coin -= 15
if "" in shop_items:
player_data.coin -= 30
except:
pass
class main_script(shop_script):
#enter game
for text in text_startgame:
print(text)
while True:
answer =input()
if "start" in answer:
while True:
for text in text_ingame:
print(text)
answer_ingame =input()
#↓↓this is the problem
if "1" in answer_ingame:
print(f"({shop_item}) is in stock,({shop_weapon}) is in stock")
print(f"coin:{player_data.coin}")
shop =["same as text_startgame"]
for text in shop:
print(text)
answer_shopchoice =input()
if "1" in answer_shopchoice:
shop_script.shop_items()
if "3" in answer_shopchoice:
shop_item =r.choice(Game_data.item)
shop_weapon =r.choice(Game_data.weapon)
if "2" in answer_ingame:
print("wip")
if "data information" in answer:
#>Just a information blu<
if "quit" in answer:
break

terse hemlockBOT
#

@hasty meteor

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

sick hearth
#

!code πŸ‘‡ here's how to do it

terse hemlockBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

hasty meteor
#

Oh thank

terse hemlockBOT
#
Python help channel closed using Discord native close action

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.