Cuberite Forum
Moving blocks - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Moving blocks (/thread-15.html)



Moving blocks - Tim - 02-24-2011

Can anyone give me a push in the right direction with making blocks move, i guess i can create a variable of the block and move it like
Code:
block1:SetPosY(50)
but i dont know how to get a block element to use with this command? Huh


RE: Moving blocks - FakeTruth - 02-24-2011

You can't move blocks. See the world as a giant 3d grid (or table) and you can simply fill in the cells with a material (dirt, stone, glass, etc.). Cells always stay in the same position, so you can't move them.

If you want to give the impression of a moving block, you need to set the material of a cell to the material you want the block to be, and every time the block 'moves' you need to reset the old cell back to the old material (air maybe?) and fill the new cell with the block material.

Code:
World = cRoot:Get():GetWorld()
World:SetBlock( X, Y, Z, E_BLOCK_SPONGE, 0 )

This sets a block on coordinates [X, Y, Z] to a sponge material


RE: Moving blocks - Tim - 02-24-2011

Oh right that answers a lot of questions Smile thanks a lot!