• Register

Combining Lego like bricks with Minecraft mechanics

  • View media
  • View media
  • View media
  • View media
  • View media
  • View media
Post article RSS Articles


I have added a new block, the water one. It does not expand progressively, but it is "liquid" for the player.
To make it possible, you have to play with physics. Since when you are underwater, the movement is slower and you can float.
We need a block that does not collide with the player, while at the same time it does collide with the player so we know that it is inside him.
How do we resolve this inconsistency? Using different physical layers.
In Unity, physics work on multiple layers and we can uncheck which ones collide with each other:


The player is in the Default layer, which we have made not to collide with the objects that are in the water layer. With this we can go through / be in the water.
Now it is time to detect that we are in it. To do this we will create an object within the player with the same shape, but we will alter the collider and put it on another layer.
In unity you can make a collider collide or not with other colliders and, through events, you can know when another object is passing through it.
Example of a normal collider going to trigger mode:


Having the collider in trigger mode, we will review each object that the player penetrates to see if it is a water-type brick and we will write it down in a list. It is important to have the checklist and not simply sign whether or not you are in the water, because the water is made up of multiple blocks, which means that player will be "in and out" of water blocks while actually still in water.

We can get an idea of ​​whether player is completely submerged or only has his feet, based on the number of blocks that we have evidence that he is "in" at every moment.
Now that we can go through the water and know that we are inside it, we only have to alter the physics / gravity of the player.
When in the water, gravity will be reduced to 1/4 and you can also hold down the SPACE key to float up. We will also vary the gravity based on whether or not you are pressing the SPACE key so that it can go up easily, but if you stop pressing it, it will go to the bottom.


With this we will obtain a behavior similar to Minecraft, where if you keep the SPACE pressed in the water, you go up until only the little feet are left and you fall down a little constantly.

Using a shader we could get to have a more animated surface, like:

But it is not my field.

Devblog 5 - Using decals to break bricks

Devblog 5 - Using decals to break bricks

News 1 comment

In the end I decided to do the breaking a block animation. If I'm not mistaken, the technique of superimposing textures on top of others is called decal.An...

Devblog 4 - Improving the build system

Devblog 4 - Improving the build system

News

As I said before, the next improvement is that when you put a wrong brick, the system tells it visually.It does not have much mystery, I change the texture...

Devblog 3 - Fixing the rotation system

Devblog 3 - Fixing the rotation system

News

After reviewing the rotation system, the first thing I have noticed is the axis of rotation. This should be the exact center of the stud, but as you can...

Devblog 2 - Textures

Devblog 2 - Textures

News

Continuing with the damn inventory system I have chosen to use the TAB key to move between the different slots of the fast Inventory. The background color...

Comments
DJkeemstar
DJkeemstar

looks promising, will download when available

Reply Good karma Bad karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Profile
Icon
Brickcraft
Platforms
Windows
Creator
FairlyUseless
Engine
Unity
Contact
Send Message
Homepage
Github.com
Release date
Game watch
Follow
Share
Style
Genre
Adventure
Theme
Fantasy
Project
Indie
Embed Buttons
Link to Brickcraft by selecting a button and using the embed code provided more...
Brickcraft
Statistics
Last Update
Watchers
9 members
Articles
6
You may also like
Goddess
Goddess Adventure
Pandora
Pandora Adventure
Bloom: Memories
Bloom: Memories Adventure
Shuyan SAGA
Shuyan SAGA Adventure
The Warhorn
The Warhorn Adventure