Saltar al contenido

cómo hacer minecraft básico en el ejemplo de código de Python

Ten en cuenta que en las ciencias informáticas un error casi siempre tiene diversas resoluciones, así que te enseñamos lo más óptimo y mejor.

Ejemplo: cómo hacer Minecraft básico en Python

#How to make basic MINECRAFT in python? You are in the right place!'''
For this project, you need ursina installed. If you dont have ursina installed,
use this command 
pip install ursina
and then wait for the process to finish
'''#import ursina and the first person controllerfrom ursina import*from ursina.prefabs.first_person_controller import FirstPersonController

#we make this 'app' so that we can let the program run 
app = Ursina()'''
each block in minecraft is a voxel, so we make a voxel class (the blocks)
and we give these voxels some attributes
'''classVoxel(Button):def__init__(self, position =(0,0,0)):super().__init__(
            parent = scene,
            position = position,
            model ='cube',
            origin_y =0.5,
            texture ='white_cube',
            color = color.color(0,0,random.uniform(0.9,1)),
            highlight_color = color.lime)#this method below allows us to mine and place blocks on key commanddefinput(self,key):if self.hovered:if key =='left mouse down':
                voxel = Voxel(position = self.position + mouse.normal)if key =="right mouse down":
                destroy(self)#the below tells us how big the field is going to befor z inrange(20):for x inrange(20):
        voxel = Voxel(position =(x,0,z))#this calls the first person controller
player = FirstPersonController()#this makes ursina get called and runs the program
app.run()#Run the program! Hopefully, it should work!!!!Good luck mining and crafting!#This project is also on ClearCode's channel, so thanks to ClearCode.

Comentarios y puntuaciones

Te invitamos a añadir valor a nuestra información dando tu veteranía en las explicaciones.

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *