BlueGit

blue-star speeltuin

Merge remote-tracking branch 'origin/master'

timfa Tim · pushed by timfa

Authored 2022-10-21 · 4 years ago

Hash
738c6c74679c8eac4957fa6a845927f72a7b402b
5 files changed +13 −16
src/minigame/frog/floorTileDestroyer.js src/minigame/frog/frogDestroyer.js renamed +1 −1
@@ -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 @@
1class FloorTileDestroyer extends GameObject
1class FrogDestroyer extends GameObject
2{
2{
3
3
4 timeOfDestroy = 0;
4 timeOfDestroy = 0;
src/minigame/frog/floorTile.js src/minigame/frog/frogFloorTile.js renamed +2 −2
@@ -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 @@
1class FloorTile extends GameObject
1class FrogFloorTile extends GameObject
2{
2{
3 g_target_y = 0;
3 g_target_y = 0;
4
4
@@ -27,7 +27,7 @@ class FloorTile extends GameObject
27
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 ()
src/minigame/frog/fruit.js src/minigame/frog/frogFruit.js renamed +3 −3
@@ -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 @@
1class Fruit extends GameObject
1class FrogFruit extends GameObject
2{
2{
3 speed = 10;
3 speed = 10;
4
4
@@ -14,7 +14,7 @@ class Fruit extends GameObject
14
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 GameObject
23
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)
src/minigame/frog/frogScene.js +3 −4
@@ -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 Scene
98 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 Scene
163
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)
src/minigame/frog/frog.js src/minigame/frog/playerFrog.js renamed +4 −6
@@ -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 @@
1class Frog extends GameObject
1class PlayerFrog extends GameObject
2{
2{
3
3
4 speed = 100;
4 speed = 100;
@@ -54,7 +54,7 @@ class Frog extends GameObject
54
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 GameObject
67
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 GameObject
136 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 GameObject
145
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;