Merge branch 'movement'
@@ -4,9 +4,27 @@
4
4
5
5
var cell =
6
6
{
7
localPos: new vector(0, 0),
8
parentCreature: null,
9
7
10
start: function()
8
11
{
9
12
this.transform.scale.x = 0;
13
this.transform.scale.y = 0;
14
15
var scaleUpTween = new TWEEN.Tween(this.transform.scale);
16
17
scaleUpTween.to({x: [1.5, 1], y: [1.5, 1]}, Math.random() * 2200);
18
19
scaleUpTween.easing(TWEEN.Easing.Back.Out);
20
21
scaleUpTween.start();
22
},
23
24
update: function()
25
{
26
var rotated = this.localPos.rotate(this.parentCreature.transform.rotation);
27
this.transform.position = rotated.add(this.parentCreature.transform.position);
10
28
},
11
29
12
30
setType: function(typeID)
@@ -36,6 +54,8 @@ var creature =
36
54
var newCell = GameObject.create(cell, this.transform.position.x + (this.dna[i].pos.x * 32), this.transform.position.y + (this.dna[i].pos.y * 32), s_orb, 500);
37
55
38
56
newCell.setType(this.dna[i].type);
57
newCell.parentCreature = this;
58
newCell.localPos = new vector(this.dna[i].pos.x * 32, this.dna[i].pos.y * 32)
39
59
40
60
this.cellInstances.push(newCell);
41
61
}
@@ -43,7 +63,8 @@ var creature =
43
63
44
64
update: function(deltaTime)
45
65
{
46
66
this.transform.rotation += deltaTime * 60;
67
this.transform.position = this.transform.position.add(this.transform.forward().stretch(deltaTime * 250))
47
68
},
48
69
49
70
onDestroy: function()
@@ -4,9 +4,27 @@4
4
5
var cell = 5
var cell = 6
{6
{7
localPos: new vector(0, 0),8
parentCreature: null,9
7
start: function()10
start: function()8
{11
{9
12
this.transform.scale.x = 0;13
this.transform.scale.y = 0;14
15
var scaleUpTween = new TWEEN.Tween(this.transform.scale);16
17
scaleUpTween.to({x: [1.5, 1], y: [1.5, 1]}, Math.random() * 2200);18
19
scaleUpTween.easing(TWEEN.Easing.Back.Out);20
21
scaleUpTween.start();22
},23
24
update: function()25
{26
var rotated = this.localPos.rotate(this.parentCreature.transform.rotation);27
this.transform.position = rotated.add(this.parentCreature.transform.position);10
},28
},11
29
12
setType: function(typeID)30
setType: function(typeID)@@ -36,6 +54,8 @@ var creature =36
var newCell = GameObject.create(cell, this.transform.position.x + (this.dna[i].pos.x * 32), this.transform.position.y + (this.dna[i].pos.y * 32), s_orb, 500);54
var newCell = GameObject.create(cell, this.transform.position.x + (this.dna[i].pos.x * 32), this.transform.position.y + (this.dna[i].pos.y * 32), s_orb, 500);37
55
38
newCell.setType(this.dna[i].type);56
newCell.setType(this.dna[i].type);57
newCell.parentCreature = this;58
newCell.localPos = new vector(this.dna[i].pos.x * 32, this.dna[i].pos.y * 32)39
59
40
this.cellInstances.push(newCell);60
this.cellInstances.push(newCell);41
}61
}@@ -43,7 +63,8 @@ var creature =43
63
44
update: function(deltaTime)64
update: function(deltaTime)45
{65
{46
66
this.transform.rotation += deltaTime * 60;67
this.transform.position = this.transform.position.add(this.transform.forward().stretch(deltaTime * 250))47
},68
},48
69
49
onDestroy: function()70
onDestroy: function()@@ -18,3 +18,18 @@
18
18
-12-10-2021- 20:01
19
19
-12-10-2021- 20:02
20
20
-12-10-2021- 20:03
21
-12-10-2021- 20:16
22
-12-10-2021- 20:17
23
-12-10-2021- 20:18
24
-12-10-2021- 20:18
25
-12-10-2021- 20:23
26
-12-10-2021- 20:24
27
-12-10-2021- 20:24
28
-12-10-2021- 20:24
29
-12-10-2021- 20:25
30
-12-10-2021- 20:25
31
-12-10-2021- 20:25
32
-12-10-2021- 20:26
33
-12-10-2021- 20:35
34
-12-10-2021- 20:36
35
-12-10-2021- 20:36
@@ -18,3 +18,18 @@18
-12-10-2021- 20:01 18
-12-10-2021- 20:01 19
-12-10-2021- 20:02 19
-12-10-2021- 20:02 20
-12-10-2021- 20:03 20
-12-10-2021- 20:03 21
-12-10-2021- 20:16 22
-12-10-2021- 20:17 23
-12-10-2021- 20:18 24
-12-10-2021- 20:18 25
-12-10-2021- 20:23 26
-12-10-2021- 20:24 27
-12-10-2021- 20:24 28
-12-10-2021- 20:24 29
-12-10-2021- 20:25 30
-12-10-2021- 20:25 31
-12-10-2021- 20:25 32
-12-10-2021- 20:26 33
-12-10-2021- 20:35 34
-12-10-2021- 20:36 35
-12-10-2021- 20:36 @@ -4,9 +4,27 @@
4
4
5
5
var cell =
6
6
{
7
localPos: new vector(0, 0),
8
parentCreature: null,
9
7
10
start: function()
8
11
{
9
12
this.transform.scale.x = 0;
13
this.transform.scale.y = 0;
14
15
var scaleUpTween = new TWEEN.Tween(this.transform.scale);
16
17
scaleUpTween.to({x: [1.5, 1], y: [1.5, 1]}, Math.random() * 2200);
18
19
scaleUpTween.easing(TWEEN.Easing.Back.Out);
20
21
scaleUpTween.start();
22
},
23
24
update: function()
25
{
26
var rotated = this.localPos.rotate(this.parentCreature.transform.rotation);
27
this.transform.position = rotated.add(this.parentCreature.transform.position);
10
28
},
11
29
12
30
setType: function(typeID)
@@ -4,9 +4,27 @@4
4
5
var cell = 5
var cell = 6
{6
{7
localPos: new vector(0, 0),8
parentCreature: null,9
7
start: function()10
start: function()8
{11
{9
12
this.transform.scale.x = 0;13
this.transform.scale.y = 0;14
15
var scaleUpTween = new TWEEN.Tween(this.transform.scale);16
17
scaleUpTween.to({x: [1.5, 1], y: [1.5, 1]}, Math.random() * 2200);18
19
scaleUpTween.easing(TWEEN.Easing.Back.Out);20
21
scaleUpTween.start();22
},23
24
update: function()25
{26
var rotated = this.localPos.rotate(this.parentCreature.transform.rotation);27
this.transform.position = rotated.add(this.parentCreature.transform.position);10
},28
},11
29
12
setType: function(typeID)30
setType: function(typeID)@@ -19,6 +19,8 @@ var creature =
19
19
var newCell = GameObject.create(cell, this.transform.position.x + (this.dna[i].pos.x * 32), this.transform.position.y + (this.dna[i].pos.y * 32), s_orb, 500);
20
20
21
21
newCell.setType(this.dna[i].type);
22
newCell.parentCreature = this;
23
newCell.localPos = new vector(this.dna[i].pos.x * 32, this.dna[i].pos.y * 32)
22
24
23
25
this.cellInstances.push(newCell);
24
26
}
@@ -26,7 +28,8 @@ var creature =
26
28
27
29
update: function(deltaTime)
28
30
{
29
31
this.transform.rotation += deltaTime * 60;
32
this.transform.position = this.transform.position.add(this.transform.forward().stretch(deltaTime * 250))
30
33
},
31
34
32
35
onDestroy: function()
@@ -19,6 +19,8 @@ var creature =19
var newCell = GameObject.create(cell, this.transform.position.x + (this.dna[i].pos.x * 32), this.transform.position.y + (this.dna[i].pos.y * 32), s_orb, 500);19
var newCell = GameObject.create(cell, this.transform.position.x + (this.dna[i].pos.x * 32), this.transform.position.y + (this.dna[i].pos.y * 32), s_orb, 500);20
20
21
newCell.setType(this.dna[i].type);21
newCell.setType(this.dna[i].type);22
newCell.parentCreature = this;23
newCell.localPos = new vector(this.dna[i].pos.x * 32, this.dna[i].pos.y * 32)22
24
23
this.cellInstances.push(newCell);25
this.cellInstances.push(newCell);24
}26
}@@ -26,7 +28,8 @@ var creature =26
28
27
update: function(deltaTime)29
update: function(deltaTime)28
{30
{29
31
this.transform.rotation += deltaTime * 60;32
this.transform.position = this.transform.position.add(this.transform.forward().stretch(deltaTime * 250))30
},33
},31
34
32
onDestroy: function()35
onDestroy: function()