How do I…
I’ve been working on a 2d minecraft clone, and i have yet to add building and mining. How do I implement this, i need to be able to highlight the block i want to break or place on, and if i want to place on in, i need to determine which side of the block to do it on. Also, on hightlighting blocks, i would like it to only hightlight the block that a raycast from the players head on the direction of the mouse hits, as opposed to the block the mouse is on.
Here is one way of doing it. You need to use “Snap to grid” extension.
But keep in mind that this is a very clumsy method for example purposes only. There are functions here that we could do without and not perform them every frame. Also i diceded to allow the player to build throug wall if its within his reach, which may not be what you want.
Thanks so much! I’ll try to implement that as soon as I get done with a school today!
Any chance you could send me that project file via google drive?
I’d really appreciate it!
I didn’t save it, sorry. I’ll send it in dm if I have time to rebuild it. Or I can explain if it is not clear how something works.
I sketched out a small prototype, it’s a little simpler than the last one. I have not tested this mechanic in real game situations, there may be bugs.
Simple Minecraft Prototype.
Thanks! Once I implement it, ill post a link to the very early stage game (it has procedural terrain already, but generating causes lots of lag.)