diff options
| author | Code WvS <code-wvs@quantentunnel.de> | 2015-03-22 11:09:08 +0100 |
|---|---|---|
| committer | Code WvS <code-wvs@quantentunnel.de> | 2015-03-22 11:09:08 +0100 |
| commit | e77fc5ff897561c82468aa0a0ed8bb2ec80c1fd9 (patch) | |
| tree | 5ce3a11f7a3337d353d309b4b6f13325bbfee44f /objects.js | |
| parent | f6a5169f7f9673d298f3e2016f8a1cd834d79530 (diff) | |
| download | snap-yow-e77fc5ff897561c82468aa0a0ed8bb2ec80c1fd9.tar.gz snap-yow-e77fc5ff897561c82468aa0a0ed8bb2ec80c1fd9.zip | |
support sprite distances/touching
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -815,12 +815,6 @@ SpriteMorph.prototype.initBlocks = function () { category: 'sensing', spec: 'touching %clr ?' }, - reportColorIsTouchingColor: { - only: SpriteMorph, - type: 'predicate', - category: 'sensing', - spec: 'color %clr is touching %clr ?' - }, colorFiltered: { dev: true, type: 'reporter', @@ -2030,7 +2024,6 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('reportTouchingObject')); blocks.push(block('reportTouchingColor')); - blocks.push(block('reportColorIsTouchingColor')); blocks.push('-'); blocks.push(block('doAsk')); blocks.push(watcherToggle('getLastAnswer')); @@ -2899,6 +2892,14 @@ SpriteMorph.prototype.removeClone = function () { // SpriteMorph primitives +SpriteMorph.prototype.isTouching = function (other) { + var me = L.latLng(this.yPosition(), this.xPosition()); + target = L.latLng(other.yPosition(), other.xPosition()); + + // could also use leaflet's equals + return me.distanceTo(target) < 1; // 1 meter magic number +}; + // SpriteMorph hiding and showing: /* |
