Creating a Minecraft style menu in Python [Ursina]

A tutorial about creating a Minecraft style menu in Python with Ursina. The project somewhat follows from my previous tutorial on how to create a basic Minecraft setup in Python.
Original Minecraft in Python tutorial: • Creating Minecraft in ...
About 20 more videos until I get to all of Minecraft :D
Timestamps:
0:00:00 Intro
0:01:03 The Logic of the project
0:02:25 Creating the screen and menu background
0:06:30 Creating a basic draggable Item
0:11:27 Creating the grid
0:15:47 Connecting the Draggable to the grid
0:22:06 Snapping the Draggable into the cell
0:36:27 Adding Item textures
0:40:47 Adding items by pressing a button
0:52:10 Swapping overlapping items

Пікірлер: 83

  • @mixlaproduction
    @mixlaproduction3 жыл бұрын

    No wayyyyyy you made this 😁 I was watching your videos yesterday, needed some pong collision logic 😜 Definitely the best Python content on the internet man!

  • @sammple
    @sammple2 жыл бұрын

    best python content creator. full stop end of discussion. you can't even compete. So clear and simple, dosen't waste my time.

  • @luvtv7433
    @luvtv7433 Жыл бұрын

    31:10 self.x+self.scale_x/2 is the center position of the Entity, in the round operation you are just removing the remainder on an integer division, it could also work similarly with the mod % operator def center(entity): return entity.position + Vec2(entity.scale.x,-entity.scale.y)/2 def snap(pos, tile_size): xsnap = pos.x - pos.x % tile_size[0] ysnap = pos.y - pos.y % -tile_size[1] return (xsnap, ysnap) Then you call it with the center of your item: newposition=snap(center(item), item.scale) Awesome tutorials by the way, I enjoy watching them

  • @calitts4708
    @calitts47083 жыл бұрын

    A smile appeard in my face when I saw the video

  • @coooolamro7283

    @coooolamro7283

    Жыл бұрын

    Noooooooooooo!!!

  • @exoditore1929
    @exoditore19293 жыл бұрын

    this is the best, i really hope that you keep making ursina tutorials, that would be nice, greetings from Chile!

  • @B3CTOR

    @B3CTOR

    2 жыл бұрын

    Un capo 👍

  • @snowman_student
    @snowman_student3 жыл бұрын

    Keep Up the Good Work Brother, We always support you, Come up with all good tutorials and projects, People really need it, & none explains better than you!!❣

  • @obatmaagtv
    @obatmaagtv3 жыл бұрын

    Thank you for all the Tutorial, really enjoyed all of it, hope you can make more video on Ursina

  • @stephencurry3502
    @stephencurry35023 жыл бұрын

    Let's goooooooo your the most underrated youtuber

  • @simplegregg4664
    @simplegregg4664 Жыл бұрын

    Awsome video, I am a big fan of Python & Blender addons. One of the best videos so far.

  • @sandippankhaniya489
    @sandippankhaniya4892 жыл бұрын

    I liked it really so much..this engine and pyhton combination is superb..really helpful ...

  • @shadofermusic
    @shadofermusic3 жыл бұрын

    Niceeee! Hope you dont give up on ursina!

  • @muhammadaarizimam4890
    @muhammadaarizimam48903 жыл бұрын

    Please upload more tutorials on ursina engine regularly.

  • @nilesh3646
    @nilesh36463 жыл бұрын

    You are back I was waiting for it 😀😀

  • @thepaulcraft957
    @thepaulcraft9573 жыл бұрын

    I think your Community is world wide(i Hope i spelled ist right😜), greeting from germany

  • @davidli3849
    @davidli38492 жыл бұрын

    In the Item class constructor, if you add a z=-0.01, make item slightly above the grid, you can avoid the bug. I think the bug is related to the display order of background, grid and items.

  • @eshanbahuguna8088
    @eshanbahuguna80883 жыл бұрын

    Thanks man, nice video

  • @slappy_chimp
    @slappy_chimp3 жыл бұрын

    Waiting for the next one :)

  • @SanjayKumar-xn2xm
    @SanjayKumar-xn2xm3 жыл бұрын

    thanks God he remember his youtube channel password

  • @ClearCode

    @ClearCode

    3 жыл бұрын

    made me laugh :D

  • @rafaeld.3852
    @rafaeld.38523 жыл бұрын

    Sou brasileiro, amo seus vídeos

  • @SKSam-bq6zt
    @SKSam-bq6zt3 жыл бұрын

    NO WAYYYYY THE LEGEND IS BACKKK

  • @matheusrodrigues-kf6pj
    @matheusrodrigues-kf6pj3 жыл бұрын

    Python is the present!

  • @goblinslayer6375
    @goblinslayer63753 жыл бұрын

    So Cool

  • @xoxogamewolf7585
    @xoxogamewolf75857 ай бұрын

    Just made Minecraft with Ursina, I think I’m gonna add some GUI to it now!

  • @commpisto5948
    @commpisto59483 жыл бұрын

    Clear at the begining: Hello there:))

  • @armcannon7902
    @armcannon79022 жыл бұрын

    How do I make the inventory interact with the game itself

  • @hemantbisht5630
    @hemantbisht56303 жыл бұрын

    Pls continue

  • @atharvapatil7474
    @atharvapatil74743 жыл бұрын

    Please make a tutorial on tiled map editor and pytmx

  • @philtoa334
    @philtoa3343 жыл бұрын

    very good.

  • @nei6387
    @nei63872 жыл бұрын

    can you make more tutorials like this maybe like a save game and settings when you hit ESC on your keyboard

  • @mohiuddinsyed1684
    @mohiuddinsyed16843 жыл бұрын

    Where can I get the textures you used for this project?

  • @solomonbestz
    @solomonbestz3 жыл бұрын

    I just hope you would make more tutorials on Ursina ...... I want to face majorly on it and build games with it....plus there documentation for now isnt helping me 😅😅😅

  • @theimmaturegoat
    @theimmaturegoat3 жыл бұрын

    Where do you get the assets? Great job on the videos by the way

  • @ClearCode

    @ClearCode

    3 жыл бұрын

    There is an artist called Kenney who makes a huge amount of public domain art, I use his stuff most of the time (I did in this video as well) and sometimes I make my own (like in the snake game)

  • @alltrabrawl3894
    @alltrabrawl38942 жыл бұрын

    More please

  • @takky8879
    @takky88793 жыл бұрын

    Wow

  • @slappy_chimp
    @slappy_chimp3 жыл бұрын

    Need more Ursina... You can have my kidney :(

  • @zikodik946
    @zikodik9463 жыл бұрын

    Вау го 3 часть ;)

  • @stepancze1892
    @stepancze18923 жыл бұрын

    Please can you make a video how to make a random generation of terrain in python??

  • @ClearCode

    @ClearCode

    3 жыл бұрын

    working on it!

  • @stepancze1892

    @stepancze1892

    3 жыл бұрын

    @@ClearCode ok thanks I love this videos About programming.

  • @manuelgranadoscollazos5910

    @manuelgranadoscollazos5910

    2 жыл бұрын

    @@ClearCode How did it go? Lol

  • @avengersworld5487
    @avengersworld54872 жыл бұрын

    can you show us how to put the minecraft menu into the minecraft that you created

  • @rittwikde5145
    @rittwikde51453 жыл бұрын

    Can we have a video on OOPS and more on pygame and GUI please?

  • @sangeetaraisane2141
    @sangeetaraisane21413 жыл бұрын

    Please suggest a laptop for high level coding and editing vids under 1k usd

  • @AndreLuckytaFirdaus
    @AndreLuckytaFirdaus2 жыл бұрын

    Dude where can i find the assets file u use??? ive search on Artwork from Kenney but i dont know the file name or something,.. please help me

  • @AndreLuckytaFirdaus

    @AndreLuckytaFirdaus

    2 жыл бұрын

    i mean like the box and grid

  • @anonymously_smh1010
    @anonymously_smh10103 жыл бұрын

    umm hey, clear code I really appreciate the hard work on the videos but I need a code for my Minecraft game that u made. so basically suppose there are 30 blocks in x and z dimensions, so if we reach the 30th block in x or z dimension the blocks behind us will come to our front

  • @creepikpedaass2133
    @creepikpedaass21333 жыл бұрын

    Here Before 1k Views👀

  • @Ashersminicartoons
    @Ashersminicartoons3 жыл бұрын

    Could you make some javascript, HTML, CSS tutorials?

  • @randomized.person
    @randomized.person2 жыл бұрын

    Can you please make a tutorial about making this menu in pygame

  • @AmanPatel-lo3ce
    @AmanPatel-lo3ce2 жыл бұрын

    Which green screen software are you using?

  • @ClearCode

    @ClearCode

    2 жыл бұрын

    It is called Open Broadcaster Software or obs. I have made a whole video on how I make tutorials: kzread.info/dash/bejne/h3mX0NZwotfVqNo.html

  • @kahwigulum
    @kahwigulum2 жыл бұрын

    I haven't seen anyone successfully create an inventory system of differently shaped items. Like a 4x4 block or a 1x3 block all existing in the same inventory sort of like Diablo or Path of Exile.

  • @alltrabrawl3894
    @alltrabrawl38942 жыл бұрын

    More Please Please Please Please Please Please Please

  • @onemeeliondollars
    @onemeeliondollars2 жыл бұрын

    25:03 when his fps went to 1060

  • @AlejandroSanchez-gn9vg
    @AlejandroSanchez-gn9vg Жыл бұрын

    I don't find the textures anywhere. Where can I find them?

  • @ravenovreaper
    @ravenovreaper3 жыл бұрын

    what compiler do you use help mee

  • @HeitorYT
    @HeitorYT3 жыл бұрын

    What about make with... C++?

  • @valencefootball9740
    @valencefootball97403 жыл бұрын

    Source CODE!???

  • @javaSucks
    @javaSucks3 жыл бұрын

    What's IDE you used for this?

  • @spectronimo7964

    @spectronimo7964

    3 жыл бұрын

    sublime text i think

  • @cedricjacob6954
    @cedricjacob69543 жыл бұрын

    next video: how to make a Minecraft client.

  • @rednibcoding3412
    @rednibcoding34122 жыл бұрын

    Could you continue this series and make a tutorial on how to proceduraly generate a big world with biomes and stuff like in minecraft?

  • @kotaiahchowdary5920
    @kotaiahchowdary59202 жыл бұрын

    me trying game developmet in unity, watch one video of this guy, pip install ursina

  • @kenhriviu9130
    @kenhriviu91303 жыл бұрын

    can u share about Sokuban game

  • @refactoringg
    @refactoringg2 жыл бұрын

    Next: UrsinaNetworking

  • @m0ke0
    @m0ke02 жыл бұрын

    I get an error: TypeError: __init__() missing 1 required positional argument: 'container' can someone help pls?

  • @theanimeguy4556
    @theanimeguy45562 жыл бұрын

    Sir please make a minecraft multiplayer using the ursina game engine

  • @simex4274
    @simex42742 жыл бұрын

    Can you upload your code for this project? Thanks

  • @sedatyilmaz6907
    @sedatyilmaz69072 жыл бұрын

    Hello, May you kindly share the source code please ?

  • @PanKDev
    @PanKDev4 ай бұрын

    no more facecam please it is the worst jumpscare I never had. nice tuto.

  • @johncanfield5250
    @johncanfield5250 Жыл бұрын

    "making minecraft in python" = I made 2048 with minecraft textures

  • @harshittechnology6955
    @harshittechnology69553 жыл бұрын

    Plz give us source code too

  • @puravm9294
    @puravm92943 жыл бұрын

    0:02 Obi Wan Kenobi

  • @onemeeliondollars
    @onemeeliondollars2 жыл бұрын

    34:22

  • @michaelnotfound2123
    @michaelnotfound21232 жыл бұрын

    Where's The Texture's?

  • @avengersworld5487
    @avengersworld54872 жыл бұрын

    pleeeeeeeeeeeeeaaaaaaaaaaaaase

  • @jkwiz1923
    @jkwiz19232 жыл бұрын

    TypeError: 'NoneType' object is not subscriptable the code *from ursina import * from random import choice class BG(Entity): def __init__(self): super().__init__( parent=camera.ui, model='quad', scale=(0.56, 0.86), texture=load_texture('bg.png') ) class Item(Draggable): def __init__(self, container, type, pos): super().__init__( parent=container, model='quad', color=color.white, texture = type, scale_x=1 / container.texture_scale[0] * 0.84, scale_y=1 / container.texture_scale[1] * 0.84, origin=(-0.6, 0.6), x=pos[0] * 1 / container.texture_scale[0], y=pos[1] * 1 / container.texture_scale[1] ) def drag(self): self.xy_pos = (self.x, self.y) def drop(self): self.x = int((self.x + self.scale_x / 2) * 5) / 5 self.y = int((self.y - self.scale_y / 2) * 8) / 8 self.menu_constraint() def menu_constraint(self): if self.x 1 or self.y > 0 or self.y self.x = self.xy_pos[0] self.y = self.xy_pos[1] def get_cell_pos(self): x = int(self.x * self.parent.texture_scale[0]) y = int(self.y * self.parent.texture_scale[1]) return Vec2(x, y) class Grid(Entity): def __init__(self): super().__init__( parent=camera.ui, model='quad', texture=load_texture('box.png'), texture_scale=(5, 8), scale=(0.5, 0.8), origin=(-0.5, 0.5), position=(-0.25, 0.4)) self.import_textures() self.add_new_item() def add_new_item(self): pos = self.find_free_cell() Item(self, choice(self.Textures[2]), pos) def find_free_cell(self): all_cells = [Vec2(x, y) for y in range(0, -8) for x in range(0, 5)] taken_cells = [child.get_cell_pos for child in self.children] for cell in all_cells: if cell not in taken_cells: return cell def import_textures(self): Dirt = load_texture('dirt2d.png'), Grass = load_texture('grass2d.png'), Brick = load_texture('brick2d.png'), Rock = load_texture('stone2d.png'), self.Textures = [Grass, Brick, Dirt, Rock] def input(key): if key == 'a': menu_grid.add_new_item() app = Ursina() bg = BG() menu_grid = Grid() app.run()*

  • @Miquelete20
    @Miquelete202 жыл бұрын

    How are you Christian?

  • @michaeldavis6473
    @michaeldavis6473 Жыл бұрын

    Neat but useless, because it glitches and isn't easy to understand. Plus it's outside the box at the bottom and right sides. What was your BG, Grid and items pixel sizes? Didn't see that part in the tutorial. from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController from random import choice app = Ursina() global windowFullscreen global inventoryOpen global inventory_BG global inventory_Grid global inventory_Item inventory_BG = () inventory_Grid = () inventory_Item = () windowFullscreen = 0 inventoryOpen = 0 fullscreenKey = 'f' inventoryKey = 'i' # Load Object Textures sky_texture = load_texture('textures/backgrounds/sky2_image.png') cursor_texture = load_texture('textures/cursors/cursor_image.png') grass1_texture = load_texture('textures/blocks/grass1_block.png') grass2_texture = load_texture('textures/blocks/grass2_block.png') dirt1_texture = load_texture('textures/blocks/dirt1_block.png') weapon_texture = load_texture('textures/weapons/sword_image.png') # Player 1 Attributes player1 = FirstPersonController() player1.cursor.texture = texture=cursor3_texture player1.cursor.visible = True player1Cursor = Entity(parent=camera.ui, model='quad', scale=.3, rotation_x=0, rotation_z=0, texture=cursor_texture) player1.gravity = 0.5 player1.speed = 6 player1.x = 5 player1.y = 3 player1.z = 5 # Application's Title window.title = 'Inventory Menu' # Window Settings window.color = color.rgb(0,100,200) window.fullscreen = True window.borderless = True window.exit_button.visible = False window.fps_counter.enabled = False window.vsync = False Sky(texture=sky_texture,shader="None") pause_handler = Entity(ignore_paused=True) class BG(Entity): # Inventory Background def __init__(self): super().__init__( parent = camera.ui, model = 'quad', scale = (0.56,0.86), texture = load_texture('textures/menus/bg.png')) class Grid(Entity): # Inventory Grid def __init__(self): super().__init__( parent = camera.ui, model = 'quad', texture = load_texture('textures/menus/inventoryGrid.png'), texture_scale = (5,8), # Number Of Cells In Grid x * y scale = (0.5,0.8), origin = (-5.0,0.5), position = (-0.25,0.4)) self.import_textures() self.add_new_item() def add_new_item(self): pos = self.find_free_cell() if pos: Item(self,choice(self.textures),pos) def find_free_cell(self): all_cells = [Vec2(x,y) for y in range(0,-8,-1) for x in range(0,5)] taken_cells = [child.get_cell_pos() for child in self.children] if (len(taken_cells)) >= len(all_cells): return False for cell in all_cells: if cell not in taken_cells: return cell def import_textures(self): grass1 = load_texture('textures/blocks/grass1_block.png') grass2 = load_texture('textures/blocks/grass2_block.png') dirt1 = load_texture('textures/blocks/dirt1_block.png') weapon = load_texture('textures/weapons/sword_image.png') self.textures = [grass1,grass2,dirt1,weapon] class Item(Draggable): # Inventory Items def __init__(self,container,type,pos): super().__init__( parent = container, model = 'quad', color = color.white, texture = type, scale_x = 1 / (container.texture_scale[0] * 1.2), # Item Size For x scale_y = 1 / (container.texture_scale[1] * 1.2), # Item Size For y origin = (-0.6,0.6), x = pos[0] * 1 / container.texture_scale[0], y = pos[1] * 1 / container.texture_scale[1]) def drag(self): self.xy_pos = (self.x,self.y) def drop(self): self.x = int((self.x + self.scale_x/2) * 5) / 5 # Item Placement On Grid For x self.y = int((self.y - self.scale_y/2) * 8) / 8 # Item Placement On Grid For y self.menu_constraint() self.overlap_check() def overlap_check(self): for child in self.parent.children: if child.x == self.x and child.y == self.y: if child == self: continue else: child.x = self.xy_pos[0] child.y = self.xy_pos[1] def menu_constraint(self): if self.x 1 or self.y > 0 or self.y self.x = self.xy_pos[0] self.y = self.xy_pos[1] def get_cell_pos(self): x = int(self.x * self.parent.texture_scale[0]) y = int(self.y * self.parent.texture_scale[1]) return Vec2(x,y) def input(key): global windowFullscreen global inventoryOpen global inventory_BG global inventory_Grid global inventory_Item if key == 'a': # Test Add Item To Inventory 'a' inventory_Grid.add_new_item() if (key == inventoryKey): # Inventory Menu Key 'i' if inventoryOpen == 0: inventoryOpen = 1 player1.disable = True mouse.visible = True mouse.locked = False inventory_BG = BG() inventory_Grid = Grid() else: if inventoryOpen == 1: inventoryOpen = 0 player1.disable = False mouse.visible = False mouse.locked = True destroy(inventory_BG) destroy(inventory_Grid) if (key == fullscreenKey): # Fullscreen Key 'f' if (windowFullscreen == 1): windowBoarderless = 0 window.borderless = True windowFullscreen = 0 window.fullscreen = True else: if (windowFullscreen == 0): windowBoarderless = 1 window.borderless = False windowFullscreen = 1 window.fullscreen = False class Voxel(Button): def __init__(self,position = (0,0,0), texture = grass1_texture): super().__init__( parent = scene, position = position, model = Entity(model='cube',texture=texture), origin_y = 0.5, texture = texture, color = color.color(0,0,random.uniform(0.9,1)), scale = 1) def input(self,key): if self.hovered: if key == 'left mouse down': if block_picked == 1: voxel = Voxel(position = self.position + mouse.normal, texture = grass1_texture) if block_picked == 2: voxel = Voxel(position = self.position + mouse.normal, texture = dirt1_texture) if block_picked == 3: voxel = Voxel(position = self.position + mouse.normal, texture = grass2_texture) if key == 'right mouse down': destroy(self) class Sky(Entity): def __init__(self,position = (0,1,0), texture = sky_texture): super().__init__( parent = scene, position = position, model = Entity(model='sphere',texture=sky_texture), texture = texture, origin_y = 0.5, scale = 0, double_sided = True) pause_handler.input = pause_handler_input for z in range(20): for x in range(20): voxel = Voxel(position = (x,0,z)) sky = Sky() app.run()