Система монет в Урсине работает в Windows, но не в LinuxPython

Программы на Python
Ответить
Anonymous
 Система монет в Урсине работает в Windows, но не в Linux

Сообщение Anonymous »

Я и мой друг делаем игру на движке Ursina, Python. Мой друг (который использует Windows) говорит мне, что на его машине код работает отлично, а у меня на компьютере, когда я запускаю код, выскакивает вот такая ошибка:
:linmath(warning): Tried to invert singular LMatrix4.
Assertion failed: !point.is_nan() at line 181 of
panda/src/collide/collisionEntry.I
Assertion failed: !point.is_nan() at line 181 of
panda/src/collide/collisionEntry.I
Traceback (most recent call last):
File "/home/javier-illo/.local/lib/python3.12/site- packages/ursina/main.py", line 167, in _update
__main__.update()
File "/home/javier-illo/Documentos/programacion/skibidiPomniGame/main.py", line 103, in update
hit_info = player.intersects()
^^^^^^^^^^^^^^^^^^^


Я не знаю, что происходит в player.intersects(), потому что раньше он работал с этой строкой кода, мой друг многое изменил в код и перестал работать. Вот код:
from ursina import * from ursina.prefabs.platformer_controller_2d import PlatformerController2d from ursina.prefabs.sky import Sky app = Ursina(fullscreen=True, title="Five Nihts In Anime - Deluxe")

dev=False

#todos los entities aqui porfa (que no sean generados por una clase claro)

sky = Sky() player = PlatformerController2d(y=0, z=.01, scale_z=0, scale_y=2, max_jumps=2, collider="box", gravity=.4, texture="assets/idle.png", color=color.white) ground = Entity(model="cube",z=.01, y=-3, scale_x=30, scale_y=3, collider="box", color = color.green, texture = "grass") world_border = Entity(model="cube",z=.01, x=-6.5, scale_y=10, scale_x=1.5, collider="box", color = color.brown, texture = "brick") pata = Entity(model='cube',z=.01,x=100,y=0, color=color.red, collider = 'box') coin_counter = 0 text_coin = Text('Coins: ' + str(coin_counter), scale=4)

if dev:
save=open('coordinates.txt','w')
cur1=Button(model='cube',z=.01,x=0,y=3, color=color.blue,parent=scene, texture="assets/pomni.png")
cur2=Button(model='cube',z=.01,x=0,y=3, color=color.yellow,parent=scene, texture="assets/pomni.png")
cur3=Button(model='cube',z=.01,x=0,y=3, color=color.red,parent=scene, texture="assets/pomni.png")
cur4=Button(model='cube',z=.01,x=0,y=3, color=color.green,parent=scene, texture="assets/pomni.png")
cur0=Button(model='cube',position=player.position, color=color.black,parent=scene, texture="assets/pomni.png")

#clases

class Coin(Entity):
def __init__(self, position = (0,0,.01), color=color.yellow,size=(1, 1)):
super().__init__(
parent = scene,
position = position,
model='cube',
collider='box',
origin_y = 0,
size=(1,1),
color=color
)

class Block(Entity):
def __init__(self, position = (0,0,.01), color=color.brown, texture='brick'):
super().__init__(
parent = scene,
position = position,
model='cube',
collider='box',
origin_y = 0,
size=(1,1),
color=color,
texture=texture
)

#generacion del nivel

def spawncoin(x,y):
coin = Coin(position=(x,y,.01))

def spawnblock(x,y):
block = Block(position=(x,y,.01))

spawncoin(3,3) spawncoin(4,3) for ix in range(8):
for iy in range(2):
spawnblock(ix,0-iy)

runCont=0 def run():
global runCont
if runCont4:
player.texture='assets/run1.png'
runCont -= 0.1
elif runCont>3 :
player.texture='assets/run2.png'
runCont -= 0.1
elif runCont>2:
player.texture='assets/run2.png'
runCont -= 0.1
elif runCont>1:
player.texture='assets/run3.png'
runCont -= 0.1
else:
player.texture='assets/run2.png'
runCont -= 0.1
#Update

def update():
if held_keys['a'] or held_keys['d']:
run()
else:
player.texture='assets/idle.png'
#Capitalism stuff
global coin
global coin_counter
global text_coin
global hit_info

destroy(text_coin)
text_coin = Text('Coins: ' + str(coin_counter), scale=4, origin=(1, -3.5), color=color.yellow, font="assets/comic-sans-ms.ttf")
hit_info = player.intersects()
if hit_info.hit and hit_info.entity.__class__ == Coin:
coin_counter += 1
destroy(hit_info.entity)
if dev:
cur1.x=cur0.x -1
cur1.y=cur0.y
cur2.x=cur0.x
cur2.y=cur0.y +1
cur3.x=cur0.x +1
cur3.y=cur0.y
cur4.x=cur0.x
cur4.y=cur0.y -1

if cur1.hovered:
cur0.x -= 0.5
if cur2.hovered:
cur0.y += 0.5
if cur3.hovered:
cur0.x += 0.5
if cur4.hovered:
cur0.y -= 0.5

camera.position = (player.x + 3, 2)
class Fake(Button):
def __init__(self, position = (0,0,.01), color=color.white, texture='brick',type=str):
super().__init__(
parent = scene,
position = position,
model='cube',
collider='box',
origin_y = 0,
size=(1,1),
color=color,
texture=texture,
type=type
)
save.write('spawn'+Ftype+'('+str(self.x)+','+str(self.y)+')'+';')

if dev:
Ftexture=str
Fcolor=color.yellow
Ftype='coin'

def spawnFake(x,y):
fake = Fake(position=(x,y,.01),texture=Ftexture,color=Fcolor,type=Ftype)

#Controles (excepto los que ya vienen en 'PlatformerController2d') dir = 1 def input(key):
#patada
global dir
if key == 'a':
dir = 0
elif key == 'd':
dir = 1
if key == 'e':
if dir == 0:
pata.x = player.x - 1
else:
pata.x = player.x + 1
pata.y = player.y + 0.5
else:
pata.x = 10
pata.y = 10
#destructor de realidades (cierra el juego)
if key == "escape":
application.quit()
if dev:
global Ftype
global Ftexture
global Fcolor
if key=='1':
Ftype='coin'
Ftexture='none'
Fcolor=color.yellow
if key=='2':
Ftype='block'
Ftexture='brick'
Fcolor=color.brown
if cur0.hovered:
if key=='left mouse down':
spawnFake(cur0.x,cur0.y) app.run()


Подробнее здесь: https://stackoverflow.com/questions/793 ... t-on-linux
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»