rename + no longer remove all tweens
@@ -1,4 +1,4 @@
1
class FloorTileDestroyer extends GameObject
1
class FrogDestroyer extends GameObject
2
2
{
3
3
4
4
timeOfDestroy = 0;
@@ -1,4 +1,4 @@1
class FloorTileDestroyer extends GameObject1
class FrogDestroyer extends GameObject2
{2
{3
3
4
timeOfDestroy = 0;4
timeOfDestroy = 0;@@ -1,4 +1,4 @@
1
class FloorTile extends GameObject
1
class FrogFloorTile extends GameObject
2
2
{
3
3
g_target_y = 0;
4
4
@@ -27,7 +27,7 @@ class FloorTile extends GameObject
27
27
28
28
onDestroy ()
29
29
{
30
this.scene.addObject(new FloorTileDestroyer(this.transform.position.x, this.transform.position.y, this.scene.game.images.tile_floor_explosion, 0, .05, true));
30
this.scene.addObject(new FrogDestroyer(this.transform.position.x, this.transform.position.y, this.scene.game.images.tile_floor_explosion, 0, .05, true));
31
31
}
32
32
33
33
animate ()
@@ -1,4 +1,4 @@1
class FloorTile extends GameObject1
class FrogFloorTile extends GameObject2
{2
{3
g_target_y = 0;3
g_target_y = 0;4
4
@@ -27,7 +27,7 @@ class FloorTile extends GameObject27
27
28
onDestroy ()28
onDestroy ()29
{29
{30
this.scene.addObject(new FloorTileDestroyer(this.transform.position.x, this.transform.position.y, this.scene.game.images.tile_floor_explosion, 0, .05, true));30
this.scene.addObject(new FrogDestroyer(this.transform.position.x, this.transform.position.y, this.scene.game.images.tile_floor_explosion, 0, .05, true));31
}31
}32
32
33
animate ()33
animate ()@@ -1,4 +1,4 @@
1
class Fruit extends GameObject
1
class FrogFruit extends GameObject
2
2
{
3
3
speed = 10;
4
4
@@ -14,7 +14,7 @@ class Fruit extends GameObject
14
14
15
15
onCollision (obj)
16
16
{
17
if (obj instanceof FloorTile)
17
if (obj instanceof FrogFloorTile)
18
18
{
19
19
obj.destroy();
20
20
this.scene.destroyFruit(this);
@@ -23,7 +23,7 @@ class Fruit extends GameObject
23
23
24
24
onDestroy ()
25
25
{
26
this.scene.addObject(new FloorTileDestroyer(this.transform.position.x, this.transform.position.y, this.scene.game.images.tile_floor_explosion, 0, .05, true));
26
this.scene.addObject(new FrogDestroyer(this.transform.position.x, this.transform.position.y, this.scene.game.images.tile_floor_explosion, 0, .05, true));
27
27
}
28
28
29
29
update (deltaTime)
@@ -1,4 +1,4 @@1
class Fruit extends GameObject1
class FrogFruit extends GameObject2
{2
{3
speed = 10;3
speed = 10;4
4
@@ -14,7 +14,7 @@ class Fruit extends GameObject14
14
15
onCollision (obj)15
onCollision (obj)16
{16
{17
if (obj instanceof FloorTile)17
if (obj instanceof FrogFloorTile)18
{18
{19
obj.destroy();19
obj.destroy();20
this.scene.destroyFruit(this);20
this.scene.destroyFruit(this);@@ -23,7 +23,7 @@ class Fruit extends GameObject23
23
24
onDestroy ()24
onDestroy ()25
{25
{26
this.scene.addObject(new FloorTileDestroyer(this.transform.position.x, this.transform.position.y, this.scene.game.images.tile_floor_explosion, 0, .05, true));26
this.scene.addObject(new FrogDestroyer(this.transform.position.x, this.transform.position.y, this.scene.game.images.tile_floor_explosion, 0, .05, true));27
}27
}28
28
29
update (deltaTime)29
update (deltaTime)@@ -98,19 +98,18 @@ class FrogScene extends Scene
98
98
if (this.spaceBarTween)
99
99
{
100
100
this.spaceBarTween.stop();
101
TWEEN.removeAll();
102
101
}
103
102
104
103
this.doAwayMenuScreenTween();
105
104
106
let frog = new Frog(60, this.real_size.y - 50, this.game.images.frog_basic, 0);
105
let frog = new PlayerFrog(60, this.real_size.y - 50, this.game.images.frog_basic, 0);
107
106
108
107
let tileWidth = this.game.images.tile_floor_brown.width - 2;
109
108
let tileWidthHalf = tileWidth / 2;
110
109
111
110
for (let tx = tileWidthHalf - 4; tx < this.real_size.x; tx += tileWidth)
112
111
{
113
this.addObject(new FloorTile(tx, this.real_size.y - 30, this.game.images.tile_floor_brown, 0));
112
this.addObject(new FrogFloorTile(tx, this.real_size.y - 30, this.game.images.tile_floor_brown, 0));
114
113
}
115
114
this.addObject(frog);
116
115
@@ -163,7 +162,7 @@ class FrogScene extends Scene
163
162
164
163
getFromFruitPoolOrCreate ()
165
164
{
166
return this.fruitPool.length > 0 ? this.fruitPool.pop() : this.addObject(new Fruit(0, 0, this.game.images.fruit, 0));
165
return this.fruitPool.length > 0 ? this.fruitPool.pop() : this.addObject(new FrogFruit(0, 0, this.game.images.fruit, 0));
167
166
}
168
167
169
168
setRandomSubImage (fruit)
@@ -98,19 +98,18 @@ class FrogScene extends Scene98
if (this.spaceBarTween)98
if (this.spaceBarTween)99
{99
{100
this.spaceBarTween.stop();100
this.spaceBarTween.stop();101
TWEEN.removeAll();102
}101
}103
102
104
this.doAwayMenuScreenTween();103
this.doAwayMenuScreenTween();105
104
106
let frog = new Frog(60, this.real_size.y - 50, this.game.images.frog_basic, 0);105
let frog = new PlayerFrog(60, this.real_size.y - 50, this.game.images.frog_basic, 0);107
106
108
let tileWidth = this.game.images.tile_floor_brown.width - 2;107
let tileWidth = this.game.images.tile_floor_brown.width - 2;109
let tileWidthHalf = tileWidth / 2;108
let tileWidthHalf = tileWidth / 2;110
109
111
for (let tx = tileWidthHalf - 4; tx < this.real_size.x; tx += tileWidth) 110
for (let tx = tileWidthHalf - 4; tx < this.real_size.x; tx += tileWidth) 112
{111
{113
this.addObject(new FloorTile(tx, this.real_size.y - 30, this.game.images.tile_floor_brown, 0));112
this.addObject(new FrogFloorTile(tx, this.real_size.y - 30, this.game.images.tile_floor_brown, 0));114
}113
}115
this.addObject(frog);114
this.addObject(frog);116
115
@@ -163,7 +162,7 @@ class FrogScene extends Scene163
162
164
getFromFruitPoolOrCreate ()163
getFromFruitPoolOrCreate ()165
{164
{166
return this.fruitPool.length > 0 ? this.fruitPool.pop() : this.addObject(new Fruit(0, 0, this.game.images.fruit, 0));165
return this.fruitPool.length > 0 ? this.fruitPool.pop() : this.addObject(new FrogFruit(0, 0, this.game.images.fruit, 0));167
}166
}168
167
169
setRandomSubImage (fruit)168
setRandomSubImage (fruit)@@ -1,4 +1,4 @@
1
class Frog extends GameObject
1
class PlayerFrog extends GameObject
2
2
{
3
3
4
4
speed = 100;
@@ -54,7 +54,7 @@ class Frog extends GameObject
54
54
55
55
onCollision (obj)
56
56
{
57
if (obj instanceof Fruit)
57
if (obj instanceof FrogFruit)
58
58
{
59
59
this.scene.gameOver();
60
60
}
@@ -67,7 +67,7 @@ class Frog extends GameObject
67
67
68
68
let obj = Ray.Cast(this.scene, new vector(this.transform.position.x + amount, this.scene.real_size.y), new vector(0, -1), 50);
69
69
70
return obj && obj.hitObj instanceof FloorTile;
70
return obj && obj.hitObj instanceof FrogFloorTile;
71
71
}
72
72
73
73
update (deltaTime)
@@ -136,8 +136,6 @@ class Frog extends GameObject
136
136
return;
137
137
}
138
138
139
//let obj = Ray.Cast(this.scene, collisionVector, new vector(this.tongueVectorBounce ? this.currentFacing : this.opposite_facing, -1), this.tongue_speed * 2 * deltaTime);
140
141
139
let obj = Ray.Cast(this.scene,
142
140
collisionVector,
143
141
new vector(this.tongueVectorBounce ? this.opposite_facing : this.currentFacing, -1),
@@ -145,7 +143,7 @@ class Frog extends GameObject
145
143
146
144
if (obj)
147
145
{
148
if (obj.hitObj instanceof Fruit)
146
if (obj.hitObj instanceof FrogFruit)
149
147
{
150
148
obj = obj.hitObj;
151
149
obj.collider.enabled = false;
@@ -1,4 +1,4 @@1
class Frog extends GameObject1
class PlayerFrog extends GameObject2
{2
{3
3
4
speed = 100;4
speed = 100;@@ -54,7 +54,7 @@ class Frog extends GameObject54
54
55
onCollision (obj) 55
onCollision (obj) 56
{56
{57
if (obj instanceof Fruit)57
if (obj instanceof FrogFruit)58
{58
{59
this.scene.gameOver();59
this.scene.gameOver();60
}60
}@@ -67,7 +67,7 @@ class Frog extends GameObject67
67
68
let obj = Ray.Cast(this.scene, new vector(this.transform.position.x + amount, this.scene.real_size.y), new vector(0, -1), 50);68
let obj = Ray.Cast(this.scene, new vector(this.transform.position.x + amount, this.scene.real_size.y), new vector(0, -1), 50);69
69
70
return obj && obj.hitObj instanceof FloorTile;70
return obj && obj.hitObj instanceof FrogFloorTile;71
}71
}72
72
73
update (deltaTime)73
update (deltaTime)@@ -136,8 +136,6 @@ class Frog extends GameObject136
return;136
return;137
}137
}138
138
139
//let obj = Ray.Cast(this.scene, collisionVector, new vector(this.tongueVectorBounce ? this.currentFacing : this.opposite_facing, -1), this.tongue_speed * 2 * deltaTime);140
141
let obj = Ray.Cast(this.scene,139
let obj = Ray.Cast(this.scene,142
collisionVector,140
collisionVector,143
new vector(this.tongueVectorBounce ? this.opposite_facing : this.currentFacing, -1),141
new vector(this.tongueVectorBounce ? this.opposite_facing : this.currentFacing, -1),@@ -145,7 +143,7 @@ class Frog extends GameObject145
143
146
if (obj)144
if (obj)147
{145
{148
if (obj.hitObj instanceof Fruit)146
if (obj.hitObj instanceof FrogFruit)149
{147
{150
obj = obj.hitObj;148
obj = obj.hitObj;151
obj.collider.enabled = false;149
obj.collider.enabled = false;