-4

I am using pygame and vscode to make a zelda themed rpg.
But when I was creating the level, I stumbled upon this error in 'level.py':

https://github.com/yedonbro/pygamer/raw/main/Untitled.png

the console:

https://github.com/yedonbro/pygamer/raw/main/ooged.png

  • 2
    Welcome to Stackoverflow! Please post your code as snippets and not images. – Lucas Feb 01 '22 at 21:35
  • 1
    Then do not mix spaces and tabs ... this mostly happens if you copy/paste stuff together when coding. Your IDE should be able to fix it - if not, fix it manually or use some other editor / IDE. – Patrick Artner Feb 01 '22 at 21:37
  • Dupe: [https://stackoverflow.com/questions/5685406/inconsistent-use-of-tabs-and-spaces-in-indentation](https://stackoverflow.com/questions/5685406/inconsistent-use-of-tabs-and-spaces-in-indentation) – Patrick Artner Feb 01 '22 at 21:38

3 Answers3

1

Your def run is one tab over the supposed indentation.

Do this

def __init__(self):
    something...

def run(self):
    other_things...

instead of

def __init__(self):
        something...
    
    def run(self):
        other_things...
Arson 0
  • 757
  • 2
  • 14
0

You are probably mixing tabs and spaces to indent your code. Make sure all indentations are actually 4 spaces, and not tabs. (You can use spaces or tabs for indentation in Python, but it needs to be consistent, you can't mix both).

Louis
  • 46
  • 2
0

there's some problem with vs i guess, do ctrl shift p then search for "convert indentation to spaces"

then it should be fixed, you can switch to tabs after