eforgacs-games / Dragon_Warrior

This is a clone of Dragon Warrior for the Nintendo Entertainment System, done in Python.
5 stars 2 forks source link

how do i run the code in vscode studio #153

Open jobjojo opened 4 weeks ago

jobjojo commented 4 weeks ago

PS C:\Users\ayub_\Documents\DragonWarrior> & C:/Python312/python.exe c:/Users/ayub/Documents/DragonWarrior/src/game.py pygame 2.5.2 (SDL 2.28.3, Python 3.12.2) Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "c:\Users\ayub\Documents\Dragon_Warrior\src\game.py", line 14, in from data.text.intro_lookuptable import ControlInfo ModuleNotFoundError: No module named 'data' PS C:\Users\ayub\Documents\DragonWarrior> pip install pygame-menu -U Requirement already satisfied: pygame-menu in c:\python312\lib\site-packages (4.4.3) Requirement already satisfied: pygame>=1.9.3 in c:\python312\lib\site-packages (from pygame-menu) (2.5.2) Requirement already satisfied: pyperclip in c:\python312\lib\site-packages (from pygame-menu) (1.8.2) Requirement already satisfied: typing-extensions in c:\python312\lib\site-packages (from pygame-menu) (4.12.1) PS C:\Users\ayub\Documents\Dragon_Warrior> python -m pip install -U pygame==2.5.2 --user

Requirement already satisfied: pygame==2.5.2 in c:\python312\lib\site-packages (2.5.2) PS C:\Users\ayub_\Documents\Dragon_Warrior> python -m pip install -U pygame==2.5.1 --user

Collecting pygame==2.5.1 Downloading pygame-2.5.1-cp312-cp312-win_amd64.whl.metadata (13 kB) Downloading pygame-2.5.1-cp312-cp312-winamd64.whl (10.6 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.6/10.6 MB 25.2 MB/s eta 0:00:00 Installing collected packages: pygame Successfully installed pygame-2.5.1 PS C:\Users\ayub\Documents\Dragon_Warrior> python -m pip install -U pygame==2.5.1 --user

Requirement already satisfied: pygame==2.5.1 in c:\users\ayub\appdata\roaming\python\python312\site-packages (2.5.1) PS C:\Users\ayub\Documents\Dragon_Warrior>

eforgacs commented 4 weeks ago

Hi, got it to work in VSCode, just pushed a couple of path-related fixes in #154 , make sure to pull the latest code. Also make sure that if you have a launch.json / settings.json file in your .vscode directory, that they're configured properly. Here are the settings that worked for me, you'll have to adjust it for your system:

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "env": {
                "PYTHONPATH": "${workspaceFolder}"
            },
            "cwd": "${workspaceFolder}"
        }
    ]
}

settings.json:


 {
    "python.pythonPath": "C:/Users/Eddie/PycharmProjects/Dragon_Warrior/venv/Scripts/python.exe",
    "python.envFile": "${workspaceFolder}/.env"
}