Skip to content

Commit 353e533

Browse files
Cleaned up FieldController dealloc
1 parent d0794a3 commit 353e533

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

js/BubbleDots/BubbleDotsConstants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Version:
1919
ENTITY_DEFAULT_RADIUS : 17,
2020
GAME_WIDTH : 700,
2121
GAME_HEIGHT : 450,
22-
MAX_CIRCLES : 40,
22+
MAX_CIRCLES : 200,
2323
GAME_DURATION : 1000*300,
2424

2525
ENTITY_TYPES: {

js/BubbleDots/BubbleDotsServerGame.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Version:
7373
var entity = this.createEntity( BubbleDots.CircleEntity, radius, this.getNextEntityID(), RealtimeMultiplayerGame.Constants.SERVER_SETTING.CLIENT_ID );
7474

7575
// Randomly make the object 'food' or 'poison'
76-
if(i%3 === 0) {
76+
if(i%10 === 0) {
7777
entity.addTraitAndExecute( new BubbleDots.traits.PoisonTrait() );
7878
} else {
7979
entity.addTraitAndExecute( new BubbleDots.traits.FoodTrait() );

js/BubbleDots/entities/PlayerEntity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var count = 0;
3333

3434
handleInput: function( speedFactor ) {
3535
var moveSpeed = 0.3;
36-
if( this.input.isLeft() ) this.acceleration.x -= moveSpeed;
36+
if( this.input.isLeft() ) this.acceleration.x -= moveSpeed*2.1;
3737
if( this.input.isRight() ) this.acceleration.x += moveSpeed;
3838
if( this.input.isUp() ) this.acceleration.y -= moveSpeed;
3939
if( this.input.isDown() ) this.acceleration.y += moveSpeed;

js/BubbleDots/traits/ChaseTrait.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Abstract:
3737
*/
3838
execute: function() {
3939
RATE += 0.3;
40-
this.radius = Math.random() * 20 + 5;
40+
this.radius = Math.random() * 20 + 10;
4141
this.offset = new RealtimeMultiplayerGame.model.Point( Math.cos(RATE) * this.radius, Math.sin(RATE) * -this.radius);
4242
this.chaseSpeed = Math.random() * 0.02 + 0.001;
4343
BubbleDots.traits.ChaseTrait.superclass.execute.call(this);

js/BubbleDots/traits/FoodTrait.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Abstract:
5555

5656
BubbleDots.lib.TWEEN.remove( me._tween );
5757
me._tween = new BubbleDots.lib.TWEEN.Tween({radius: me.radius})
58-
.to({radius: 5}, 250)
58+
.to({radius: 2}, 500)
5959
.easing(BubbleDots.lib.TWEEN.Easing.Back.EaseInOut)
6060
.onUpdate(function(){
6161
me.setRadius(~~this.radius);
@@ -67,6 +67,7 @@ Abstract:
6767
// them.collisionCircle.setRadius( newRadius );
6868
me.collisionCircle.collisionGroup = 0;
6969
// me.acceleration.translatePoint( collisionNormal.multiply(-10) );
70+
7071
var chaseTrait = this.addTraitAndExecute( new BubbleDots.traits.ChaseTrait() );
7172
chaseTrait.setTarget( them );
7273
// me.tempColor();

js/controller/FieldController.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,27 +133,21 @@
133133

134134
},
135135

136-
dealloc: function()
137-
{
138-
this.isDeallocated = true;
139-
136+
dealloc: function() {
140137
this.players.forEach( function(key, entity){
141138
this.removePlayer(entity.clientid);
142139
}, this );
140+
this.players.dealloc();
141+
this.players = null;
143142

144143
this.entities.forEach( function(key, entity){
145144
this.removeEntity(entity.entityid);
146145
}, this );
147-
148-
149146
this.entities.dealloc();
150-
this.players.dealloc();
147+
this.entities = null;
151148

152-
this.view = null;
153149

154-
delete this.view;
155-
delete this.players;
156-
delete this.entities;
150+
this.view = null;
157151
},
158152

159153
///// Accessors

0 commit comments

Comments
 (0)