Skip to content

Commit c152156

Browse files
committed
Zone now working again and useful for interactive hit areas not bound to Sprites or other GOs.
1 parent 8e8d43d commit c152156

4 files changed

Lines changed: 36 additions & 17 deletions

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '05f6bdb0-72d0-11e7-a37c-2f5c41074ab6'
2+
build: '924a0380-72e9-11e7-a431-216550643abb'
33
};
44
module.exports = CHECKSUM;

v3/src/gameobjects/zone/Zone.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
var Class = require('../../utils/Class');
33
var GameObject = require('../GameObject');
44
var Components = require('../components');
5+
var BlendModes = require('../../renderer/BlendModes');
56

67
var Zone = new Class({
78

@@ -26,6 +27,30 @@ var Zone = new Class({
2627
this.setPosition(x, y);
2728
this.setSize(width, height);
2829
this.setOrigin(0);
30+
31+
this.blendMode = BlendModes.NORMAL;
32+
},
33+
34+
setDropZone: function (shape, callback)
35+
{
36+
if (!this.input)
37+
{
38+
this.setInteractive(shape, callback);
39+
}
40+
41+
this.input.dropzone = true;
42+
43+
return this;
44+
},
45+
46+
renderCanvas: function ()
47+
{
48+
return;
49+
},
50+
51+
renderWebGL: function ()
52+
{
53+
return;
2954
}
3055

3156
});
Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
var Zone = require('./Zone');
2-
var FactoryContainer = require('../FactoryContainer');
3-
4-
var ZoneFactory = {
5-
6-
KEY: 'zone',
7-
8-
add: function (x, y, width, height)
9-
{
10-
return new Zone(this.scene, x, y, width, height);
11-
},
12-
13-
make: function (x, y, width, height)
14-
{
15-
return new Zone(this.scene, x, y, width, height);
16-
}
172

3+
var ZoneFactory = function (scene, x, y, width, height)
4+
{
5+
return new Zone(scene, x, y, width, height);
186
};
197

20-
module.exports = FactoryContainer.register(ZoneFactory);
8+
module.exports = ZoneFactory;

v3/src/plugins/GameObjectFactory.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var StaticBitmapTextFactory = require('../gameobjects/bitmaptext/static/BitmapTe
1515
var StaticTilemapFactory = require('../gameobjects/tilemap/static/StaticTilemapFactory');
1616
var TextFactory = require('../gameobjects/text/static/TextFactory');
1717
var TileSpriteFactory = require('../gameobjects/tilesprite/TileSpriteFactory');
18+
var ZoneFactory = require('../gameobjects/zone/ZoneFactory');
1819

1920
var GameObjectFactory = new Class({
2021

@@ -121,6 +122,11 @@ var GameObjectFactory = new Class({
121122
tileSprite: function (x, y, width, height, key, frame)
122123
{
123124
return this.displayList.add(TileSpriteFactory(this.scene, x, y, width, height, key, frame));
125+
},
126+
127+
zone: function (x, y, width, height)
128+
{
129+
return this.displayList.add(ZoneFactory(this.scene, x, y, width, height));
124130
}
125131

126132
});

0 commit comments

Comments
 (0)