fenomas / noa

Experimental voxel game engine.
MIT License
616 stars 91 forks source link

I started a bare bone inventory ,lets improve it together #75

Closed levlups closed 5 years ago

levlups commented 5 years ago
<style>
#div1 {
  width: 70px;
  height: 70px;
  padding: 10px;
  border: 1px solid #aaaaaa;
  float: left;
}
</style>

    div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
     div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
       div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>

div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
img id="drag1" src="textures/dirt.png" draggable="true" ondragstart="drag(event)" ondragover="allowDrop(event)" width="40" height="40">
img id="drag2" src="textures/stone.png" draggable="true" ondragstart="drag(event)" ondragover="allowDrop(event)" width="40" height="40">*/
</body>

  <script>
function allowDrop(ev) {
  ev.preventDefault();
}

function drag(ev) {
  ev.dataTransfer.setData("text", ev.target.id);
}

function drop(ev) {
  ev.preventDefault();
  var data = ev.dataTransfer.getData("text");
  if(ev.target.hasChildNodes()===true){

  return;
  }
  if(ev.target.id!='div1'){
  return;
  }

  ev.target.appendChild(document.getElementById(data));
}
</script>
fenomas commented 5 years ago

Hi, an effort like this would probably make more sense to do in a separate repo, e.g. this one?

Incidentally github comments use markdown formatting, so you can use three backticks (```) on a blank line to start/end a code block. (I edited your comment to do this.)