Code Monkey home page Code Monkey logo

blocker-d2d's Introduction

blocker-d2d

Usage:

app.SetBlock(x, y, z, index);
  • 0 - Air
  • 1 - Stone
  • 2 - Grass
  • 3 - Dirt
  • 4 - Cobblestone
  • 5 - Planks
  • 6 - Brick

Block class:

const block = CreateBlock(app.parentElement);
block.SetBlock(index);
block.SetPosition(x, y, z); // position inside grid mapped blocks

Preview Sphere 64x64x64

Note: current version generate 16x16x16, if you want bigger sphere, just:

app.blocks.count = { x: 64, y: 64, z: 64 };

Example:

for (let z = 0; z < cz; z++) {
  for (let y = 0; y < cy; y++) {
    for (let x = 0; x < cx; x++) {
      const dx = x - cx * 0.5;
      const dy = y - cy * 0.5;
      const dz = z - cz * 0.5;
      const avg = (cx + cy + cz) / 3 * 0.5;
      const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
      app.SetBlock(
        x, y, z, 
        (distance < avg ? 2 + Math.floor(Math.random() * 0) : 0)
      );
    }
  }
}

Sphere 64x64x64

blocker-d2d's People

Contributors

doggyxomax avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.