Reputation: 31
I am attempting to follow along on a Tutorial "Creating Minecraft in Python [with the Ursina Engine]" on Youtube.
All was going well until I attempted to add texture to the Entity.
I believe the issue lies within Pandas, but I am not entirely sure.
CODE:
from ursina import *
def update():
if held_keys['a']:
test_square.x -= 4 * time.dt
app = Ursina()
test_square = Entity(model = 'quad', color = color.red, scale = (1,4), position = (5,4))
sans_texture = load_texture("C:\\Users\\north\\Desktop\\moose.png")
sans = Entity(model = 'quad', texture = sans_texture)
app.run()
ERROR IN TERMINAL:
ursina version: 3.5.0
package_folder: C:\Users\*****\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina
asset_folder: C:\Users\*****\Desktop\code
blender_paths:
{'2.7': WindowsPath('C:/Program Files/Blender Foundation/Blender/blender.exe'),
'default': WindowsPath('C:/Program Files/Blender Foundation/Blender/blender.exe')}
screen resolution: (1920, 1080)
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
size; LVector2f(1536, 864)
render mode: default
no settings.py file
no settings.py file
development mode: True
application successfully started
no filter quad
changed aspect ratio: 1.777 -> 1.778
I believe the issue is with the
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
and the
successfully started no filter quad
portions.
I do have pandas installed. To do this tutorial I needed to install Ursina. I used the python -m pip install
method, as I usually do.
I would greatly appreciate help with this matter. Thank you in advance.
Upvotes: 3
Views: 3219
Reputation: 9
Found the answer. I followed the same tutorial and encountered the same thing. It turn out that you have to declare the app (app = Ursina()) before loading the entity and texture. Otherwise, it's won't work.
Upvotes: 0
Reputation: 1489
application successfully started
means there were no errors and it started successfully. I believe the issue is the path you gave load_texture
.
load_texture("C:\\Users\\north\\Desktop\\moose.png")
means you're searching for a texture named C:\\Users\\north\\Desktop\\moose.png
in the folder where your script is located.
The arguments it takes are the name of the texture, and the folder it should search for it in. So if you insist on using load_texture
you would do something like: load_texture('moose.png', Path('C:/Users/north/Desktop'))
However you're not even supposed to use load_texture
, but put your texture in the same folder or below your script and write the name of it. If you were to share your game and have other people play it, you can't expect people to have moose.png on their desktop. The code would then be:
sans = Entity(model='quad', texture='moose')
Upvotes: 2
Reputation: 21
I had the same problem then ı tried something and it worked, all you need is destroy and recreate the object in the update function.
from ursina import *
def update():
destroy(road)
road = Entity(model="cube", texture="YOUR_TEXTURE")
app=Ursina()
app.run()
Upvotes: -1