Creating a Minecraft style menu in Python [Ursina]

  Рет қаралды 32,621

Clear Code

Clear Code

Күн бұрын

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
@mixlaproduction 3 жыл бұрын
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!
@exoditore1929
@exoditore1929 3 жыл бұрын
this is the best, i really hope that you keep making ursina tutorials, that would be nice, greetings from Chile!
@B3CTOR
@B3CTOR 3 жыл бұрын
Un capo 👍
@sammple
@sammple 2 жыл бұрын
best python content creator. full stop end of discussion. you can't even compete. So clear and simple, dosen't waste my time.
@calitts4708
@calitts4708 3 жыл бұрын
A smile appeard in my face when I saw the video
@coooolamro7283
@coooolamro7283 Жыл бұрын
Noooooooooooo!!!
@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
@snowman_student
@snowman_student 3 жыл бұрын
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
@obatmaagtv 3 жыл бұрын
Thank you for all the Tutorial, really enjoyed all of it, hope you can make more video on Ursina
@stephencurry3502
@stephencurry3502 3 жыл бұрын
Let's goooooooo your the most underrated youtuber
@shadofermusic
@shadofermusic 3 жыл бұрын
Niceeee! Hope you dont give up on ursina!
@sandippankhaniya489
@sandippankhaniya489 2 жыл бұрын
I liked it really so much..this engine and pyhton combination is superb..really helpful ...
@simplegregg4664
@simplegregg4664 Жыл бұрын
Awsome video, I am a big fan of Python & Blender addons. One of the best videos so far.
@muhammadaarizimam4890
@muhammadaarizimam4890 3 жыл бұрын
Please upload more tutorials on ursina engine regularly.
@eshanbahuguna8088
@eshanbahuguna8088 3 жыл бұрын
Thanks man, nice video
@nilesh3646
@nilesh3646 3 жыл бұрын
You are back I was waiting for it 😀😀
@davidli3849
@davidli3849 2 жыл бұрын
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.
@slappy_chimp
@slappy_chimp 3 жыл бұрын
Waiting for the next one :)
@thepaulcraft957
@thepaulcraft957 3 жыл бұрын
I think your Community is world wide(i Hope i spelled ist right😜), greeting from germany
@armcannon7902
@armcannon7902 2 жыл бұрын
How do I make the inventory interact with the game itself
@rafaeld.3852
@rafaeld.3852 3 жыл бұрын
Sou brasileiro, amo seus vídeos
@SanjayKumar-xn2xm
@SanjayKumar-xn2xm 3 жыл бұрын
thanks God he remember his youtube channel password
@ClearCode
@ClearCode 3 жыл бұрын
made me laugh :D
@mohiuddinsyed1684
@mohiuddinsyed1684 3 жыл бұрын
Where can I get the textures you used for this project?
@atharvapatil7474
@atharvapatil7474 3 жыл бұрын
Please make a tutorial on tiled map editor and pytmx
@matheusrodrigues-kf6pj
@matheusrodrigues-kf6pj 3 жыл бұрын
Python is the present!
@theimmaturegoat
@theimmaturegoat 3 жыл бұрын
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)
@goblinslayer6375
@goblinslayer6375 3 жыл бұрын
So Cool
@SKSam-bq6zt
@SKSam-bq6zt 3 жыл бұрын
NO WAYYYYY THE LEGEND IS BACKKK
@hemantbisht5630
@hemantbisht5630 3 жыл бұрын
Pls continue
@commpisto5948
@commpisto5948 3 жыл бұрын
Clear at the begining: Hello there:))
@nei6387
@nei6387 2 жыл бұрын
can you make more tutorials like this maybe like a save game and settings when you hit ESC on your keyboard
@xoxogamewolf7585
@xoxogamewolf7585 7 ай бұрын
Just made Minecraft with Ursina, I think I’m gonna add some GUI to it now!
@philtoa334
@philtoa334 3 жыл бұрын
very good.
@avengersworld5487
@avengersworld5487 2 жыл бұрын
can you show us how to put the minecraft menu into the minecraft that you created
@stepancze1892
@stepancze1892 3 жыл бұрын
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
@alltrabrawl3894
@alltrabrawl3894 2 жыл бұрын
More please
@solomonbestz
@solomonbestz 3 жыл бұрын
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 😅😅😅
@rittwikde5145
@rittwikde5145 3 жыл бұрын
Can we have a video on OOPS and more on pygame and GUI please?
@sangeetaraisane2141
@sangeetaraisane2141 3 жыл бұрын
Please suggest a laptop for high level coding and editing vids under 1k usd
@AlejandroSanchez-gn9vg
@AlejandroSanchez-gn9vg Жыл бұрын
I don't find the textures anywhere. Where can I find them?
@AndreLuckytaFirdaus
@AndreLuckytaFirdaus 2 жыл бұрын
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
@takky8879
@takky8879 3 жыл бұрын
Wow
@ravenovreaper
@ravenovreaper 3 жыл бұрын
what compiler do you use help mee
@anonymously_smh1010
@anonymously_smh1010 3 жыл бұрын
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
@randomized.person
@randomized.person 2 жыл бұрын
Can you please make a tutorial about making this menu in pygame
@Ashersminicartoons
@Ashersminicartoons 3 жыл бұрын
Could you make some javascript, HTML, CSS tutorials?
@zikodik946
@zikodik946 3 жыл бұрын
Вау го 3 часть ;)
@slappy_chimp
@slappy_chimp 3 жыл бұрын
Need more Ursina... You can have my kidney :(
@m0ke0
@m0ke0 2 жыл бұрын
I get an error: TypeError: __init__() missing 1 required positional argument: 'container' can someone help pls?
@AmanPatel-lo3ce
@AmanPatel-lo3ce 2 жыл бұрын
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: kzbin.info/www/bejne/i3bGn6dtp9mirtk
@valencefootball9740
@valencefootball9740 3 жыл бұрын
Source CODE!???
@kenhriviu9130
@kenhriviu9130 3 жыл бұрын
can u share about Sokuban game
@kahwigulum
@kahwigulum 2 жыл бұрын
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.
@onemeeliondollars
@onemeeliondollars 2 жыл бұрын
25:03 when his fps went to 1060
@HeitorYT
@HeitorYT 3 жыл бұрын
What about make with... C++?
@creepikpedaass2133
@creepikpedaass2133 3 жыл бұрын
Here Before 1k Views👀
@javaSucks
@javaSucks 3 жыл бұрын
What's IDE you used for this?
@spectronimo7964
@spectronimo7964 3 жыл бұрын
sublime text i think
@simex4274
@simex4274 3 жыл бұрын
Can you upload your code for this project? Thanks
@sedatyilmaz6907
@sedatyilmaz6907 2 жыл бұрын
Hello, May you kindly share the source code please ?
@theanimeguy4556
@theanimeguy4556 2 жыл бұрын
Sir please make a minecraft multiplayer using the ursina game engine
@harshittechnology6955
@harshittechnology6955 3 жыл бұрын
Plz give us source code too
@cedricjacob6954
@cedricjacob6954 3 жыл бұрын
next video: how to make a Minecraft client.
@refactoringg
@refactoringg 3 жыл бұрын
Next: UrsinaNetworking
@alltrabrawl3894
@alltrabrawl3894 2 жыл бұрын
More Please Please Please Please Please Please Please
@michaelnotfound2123
@michaelnotfound2123 2 жыл бұрын
Where's The Texture's?
@PanKDev
@PanKDev 4 ай бұрын
no more facecam please it is the worst jumpscare I never had. nice tuto.
@kotaiahchowdary5920
@kotaiahchowdary5920 2 жыл бұрын
me trying game developmet in unity, watch one video of this guy, pip install ursina
@onemeeliondollars
@onemeeliondollars 2 жыл бұрын
34:22
@johncanfield5250
@johncanfield5250 Жыл бұрын
"making minecraft in python" = I made 2048 with minecraft textures
@rednibcoding3412
@rednibcoding3412 2 жыл бұрын
Could you continue this series and make a tutorial on how to proceduraly generate a big world with biomes and stuff like in minecraft?
@puravm9294
@puravm9294 3 жыл бұрын
0:02 Obi Wan Kenobi
@avengersworld5487
@avengersworld5487 2 жыл бұрын
pleeeeeeeeeeeeeaaaaaaaaaaaaase
@jkwiz1923
@jkwiz1923 2 жыл бұрын
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 < 0 or self.x > 1 or self.y > 0 or self.y < -1: 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
@Miquelete20 2 жыл бұрын
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 < 0 or self.x > 1 or self.y > 0 or self.y < -1: 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()
I Made Minecraft but with Realistic Physics
14:02
Steven
Рет қаралды 6 МЛН
Делаю Игру "Змейка" в 3D на Python [ UrsinaEngine ]
13:59
Sprinting with More and More Money
00:29
MrBeast
Рет қаралды 188 МЛН
🍕Пиццерия FNAF в реальной жизни #shorts
00:41
WHO DO I LOVE MOST?
00:22
dednahype
Рет қаралды 18 МЛН
She ruined my dominos! 😭 Cool train tool helps me #gadget
00:40
Go Gizmo!
Рет қаралды 55 МЛН
I Made Minecraft in 24 Hours!
10:21
Avatar Nick Games
Рет қаралды 40 М.
What Happens To Deleted Minecraft Worlds?
13:36
Wifies
Рет қаралды 4,6 МЛН
25 Fake Minecraft "Facts" You Still Believe
9:46
Skip the Tutorial
Рет қаралды 4,7 МЛН
Buttons in Ursina Engine | Ursina Game Engine
1:37
Code 3D
Рет қаралды 1,6 М.
I Made a Working Computer with just Redstone!
15:37
mattbatwings
Рет қаралды 727 М.
I Paid Game Developers on Fiverr to Make the Same Game
9:49
BadGameDev
Рет қаралды 3,4 МЛН
Making a 4D Game - 4D Explorer
7:39
Jelle Vermandere
Рет қаралды 1,5 МЛН
Debugging in Pygame
12:28
Clear Code
Рет қаралды 13 М.
20 Impossible Ways to Play Minecraft
8:42
Skip the Tutorial
Рет қаралды 7 МЛН
I Made Minecraft Without Blocks
10:39
Sam Hogan
Рет қаралды 5 МЛН
Sprinting with More and More Money
00:29
MrBeast
Рет қаралды 188 МЛН