An easy to use game engine/framework for python.
Install Python 3.6 or newer. https://www.python.org/downloads/
Open cmd/terminal and type:
pip install ursina
If you want to install the newest version from git, you can install like this:
pip install git+https://github.com/pokepetter/ursina.git
If you want to easily edit the source, it's recommended to clone the git repo and install as develop like this. Make sure you have git installed. https://git-scm.com/
git clone https://github.com/pokepetter/ursina.git
python setup.py develop
Also install any of the optional dependencies you want from the list below, or install them all with:
pip install ursina[extras]
On some systems you might have to use pip3 instead of pip in order to use Python 3 and not the old Python 2.
from ursina import * # this will import everything we need from ursina with just one line.
app = Ursina()
ground = Entity(
model = 'cube',
color = color.magenta,
z = -.1,
y = -3,
origin = (0, .5),
scale = (50, 1, 10),
collider = 'box',
)
app.run() # opens a window and starts the game.
Ursina games are made by writing Python code. You can use any text editor you want, but personally I like to use Atom.
from ursina import * # this will import everything we need from ursina with just one line.
app = Ursina()
player = Entity(
model = 'cube' , # finds a 3d model by name
color = color.orange,
scale_y = 2
)
def update(): # update gets automatically called by the engine.
player.x += held_keys['d'] * .1
player.x -= held_keys['a'] * .1
app.run() # opens a window and starts the game.
Type this in the terminal to start the game:
python ursina_game.py
If you use Atom, I recommend installing the package atom-python-run to tun your scripts with the press of a button.
You can now move the orange box around with 'a' and 'd'!
To close the window, you can by default, press shift+q or press the red x. to disable this, write 'window.exit_button.enabled = False' somewhere in your code.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。