mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Global board position / piece boundaries
This commit is contained in:
parent
685734bdcc
commit
b4585163db
1 changed files with 6 additions and 4 deletions
|
@ -1,4 +1,6 @@
|
|||
(function(){
|
||||
this.GRID_POSITION = { x: 1, y: 1, z: 1 };
|
||||
this.GRID_SIZE = 1.0;
|
||||
this.sound = null;
|
||||
this.entityID = null;
|
||||
this.properties = null;
|
||||
|
@ -24,15 +26,16 @@
|
|||
Entities.editEntity(this.entityID, { position: intersection });
|
||||
}
|
||||
this.snapToGrid = function() {
|
||||
var position = { x: 1, y: 1, z: 1 };
|
||||
var size = 1.0;
|
||||
var position = this.GRID_POSITION;
|
||||
var size = this.GRID_SIZE;
|
||||
var tileSize = size / 8.0;
|
||||
var height = tileSize * 0.2;
|
||||
|
||||
|
||||
var relative = Vec3.subtract(this.properties.position, position);
|
||||
var i = Math.floor(relative.x / tileSize);
|
||||
var j = Math.floor(relative.z / tileSize);
|
||||
i = Math.min(Math.max(0, i), 7);
|
||||
j = Math.min(Math.max(-1, j), 8);
|
||||
|
||||
relative.x = (i + 0.5) * tileSize;
|
||||
relative.z = (j + 0.5) * tileSize;
|
||||
|
@ -58,7 +61,6 @@
|
|||
Audio.playSound(this.sound, options);
|
||||
}
|
||||
|
||||
|
||||
this.clickDownOnEntity = function(entityID, mouseEvent){
|
||||
this.maybeDownloadSound();
|
||||
this.updateProperties(entityID);
|
||||
|
|
Loading…
Reference in a new issue