/** * Part of a creature! */ var cell = { localPos: new vector(0, 0), parentCreature: null, cellRef: -1, currentSensorSignal: 0, //only used for sensors, else forever zero lastSum: 0, //used for debug purposes start: function() { this.transform.scale.x = 0; this.transform.scale.y = 0; var scaleUpTween = new TWEEN.Tween(this.transform.scale); scaleUpTween.to({x: [1.5, 1], y: [1.5, 1]}, Math.random() * 3200); scaleUpTween.easing(TWEEN.Easing.Back.Out); scaleUpTween.start(); }, draw: function() { this.defaultDraw(); GameWindow.canvasContext.fillStyle = 'black'; GameWindow.canvasContext.fillText(this.lastSum, this.transform.position.x, this.transform.position.y); }, update: function() { var rotated = this.localPos.rotate(this.parentCreature.transform.rotation); this.transform.position = rotated.stretch(this.transform.scale.x).add(this.parentCreature.transform.position); }, setType: function(typeID) { this.renderer.subImage = typeID; } }