Comparing version 0.0.19 to 0.0.21
@@ -20,4 +20,2 @@ import { Component } from '../core/component'; | ||
}, default_options, options)); | ||
Object.assign(this, default_options, options); | ||
} | ||
@@ -24,0 +22,0 @@ |
@@ -44,4 +44,5 @@ const default_options = { | ||
this.components.forEach(component => component.update(tick_delta)); | ||
this.entities.forEach(entity => entity.update(tick_delta)); | ||
const update_each = updatable => updatable.update(tick_delta); | ||
this.components.forEach(update_each); | ||
this.entities.forEach(update_each); | ||
} | ||
@@ -58,3 +59,2 @@ | ||
} | ||
} |
@@ -8,5 +8,6 @@ export class Tween { | ||
this.property = options.property; | ||
this.cb = options.cb; | ||
} | ||
do_step(tick, resolve) { | ||
do_step(tick) { | ||
this.current_step = Math.min( | ||
@@ -17,6 +18,2 @@ 1, | ||
this.action(); | ||
if (this.current_step === 1) { | ||
this.game.off('tick', this.do_step.bound); | ||
resolve(); | ||
} | ||
} | ||
@@ -36,8 +33,13 @@ | ||
return new Promise((resolve) => { | ||
this.do_step.bound = (tick) => { | ||
this.do_step(tick, resolve); | ||
const bound = (tick) => { | ||
if (this.current_step === 1) { | ||
this.game.off('tick', bound); | ||
resolve(); | ||
} else { | ||
this.do_step(tick, resolve); | ||
} | ||
}; | ||
this.game.on('tick', this.do_step.bound); | ||
this.game.on('tick', bound); | ||
}); | ||
} | ||
} |
{ | ||
"name": "cervus", | ||
"version": "0.0.19", | ||
"version": "0.0.21", | ||
"author": "Michał Budzyński <michal@virtualdesign.pl>", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:michalbe/cervus.git", |
12885
172881