The name of the input function is wrong. Input should be input
user interface - I have a problem with my python Minecraft copy - Stack Overflow
Simple Minecraft Clone in 580 lines of Python
Minecraft clone in Python tutorial
Would it ever be possible to convert Python to Minecraft command blocks? - Arqade
The name of the input function is wrong. Input should be input
The input function should be input and not Input, rest of the code is absolutely correct. So, your code should be:
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
class Vovel(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.white,
highlight_color=color.lime,
)
def input(self, key):
if self.hovered:
if key == 'left mouse down':
vovel = Vovel(position=self.position + mouse.normal)
if key == 'right mouse down':
destroy(self)
app = Ursina()
for z in range(8):
for x in range(8):
vovel = Vovel(position=(x, 0, z))
player = FirstPersonController()
app.run()
This code works, you can place a block with left click and remove a block with right click!
Here's a tutorial series I'm making on graphics programming, where I write a Minecraft clone in Python with Pyglet and OpenGL 😄
Last tutorial, which is on collision detection/response: https://youtu.be/fWkbIOna6RA
My intended audience are mainly people who already have a bit of experience with Python, but who have a hard time getting into graphics programming with Python, and I think writing a Minecraft clone is a fun way to learn!
There's also a "community" directory on the repo where there are a few extra features, like lighting, AO, game controller support, &c:
https://github.com/obiwac/python-minecraft-clone/tree/master/community
Naturally I appreciate any feedback, criticism, and suggestions you may have!