Games in Python
I'd like some help, could anyone teach me how to write games in Python?
Well, @GIORGOSMENTES, I got just the thing you've been looking for, the
It's very, very good.
Minecraft in Python by Clear Code on Youtube or if that doesn't work search
Minecraft in Python.
I'm not allowed to give the link
I'm also working on an
YOU CANT DO THIS ON A MACBOOK
Just download/install any editor, other than replit, press
Windows + s, and search Command Prompt, then open it.
Then type in Command Prompt this code:
pip install ursina
Wait for it load...
Then go back to the editor.
Then copy and paste this code and run:
from ursina import * def update(): if held_keys["w"]: test.y += 1 * time.dt if held_keys["s"]: test.y -= 1 * time.dt if held_keys["a"]: test.x -= 1 * time.dt if held_keys["d"]: test.x += 1 * time.dt test = Entity(model="quad", texture="white_cube") app.run()
With these 14 ASTOUNDING lines of code, you can make this object move.
Ursina also has many inbuilt features.
I'll just do a short summary of this code:
LINE 1: Star Import, imports everything out of
LINE 3: [There is an inbuilt function called
held_keys which gets the key pressed , instantly.]
LINE 4 PART 1:
test.y += 1: Imagine a grid with an x and y line. As the y line gets higher, so does the coordinates. So this moves it along the y line.
LINE 4 PART 2:
* time.dt: This makes sure the code runs and the frame rate, so that it isn't too fast.
LINE 14: Defines an Entity called test. The model is the shape. The options are:
circle, quad, sphere, cube and more. Quad is a square.
The texture is the decoration on it. This can be a local image, OR an inbuilt texture.
LINE 15: Runs the code.
I'm beginning to think this comment is getting a BIT too long, so I'll stop myself before I can type any further.
Hope you can UnDeRsTaNd it
Python is not the best language for games. It does not really have support for image output which makes games difficult. You have two options for making games in python. 1: Make a text based game using print() and input() where the person reads some text and then can write something that changes something and spouts some more text. Or 2: Use the python turtle library to make a game but be warned: it is a pain in the *** to do anything with it. https://docs.python.org/2/library/turtle.html.