BlueGit

blue-star speeltuin

frogfx

timfa wsadhelios · pushed by timfa

Authored 2022-10-20 · 4 years ago

Hash
da11b9ef1050324002b02300db5d230eae41f623
Parent
a0e57036
1 file changed +17 −2
src/minigame/frog/frog.js +17 −2
@@ -24,7 +24,7 @@ class Frog extends GameObject
24 24 frog_tongue_base = null;
25 25 frog_tongue_tip = null;
26 26
27 floorTileConnections = [];
27 tongue_obj_ref = null;
28 28
29 29 constructor (x, y, sprite, layer)
30 30 {
@@ -80,6 +80,7 @@ class Frog extends GameObject
80 80 if (!this.tongue_retracted)
81 81 {
82 82 this.retractTongueLength(deltaTime);
83 this.updateFruitObjRef();
83 84 }
84 85 else
85 86 {
@@ -115,8 +116,14 @@ class Frog extends GameObject
115 116
116 117 let obj = Ray.Cast(this.scene, collisionVector, new vector(this.tongueVectorBounce ? this.currentFacing : this.opposite_facing, -1), 5);
117 118
118 obj.collider.enabled = false;
119 if (obj && obj instanceof Fruit)
120 {
121 console.log(obj);
122 obj.collider.enabled = false;
123 this.tongue_obj_ref = obj;
119 124
125 this.retracting = true;
126 }
120 127
121 128 }
122 129
@@ -236,6 +243,14 @@ class Frog extends GameObject
236 243 }
237 244 }
238 245
246 updateFruitObjRef ()
247 {
248 if (this.tongue_obj_ref && (this.tongueVectorBounce || this.tongueVector))
249 {
250 this.tongue_obj_ref.position = this.tongueVectorBounce ? this.tongueVectorBounce : this.tongueVector;
251 }
252 }
253
239 254 extendTongueLength (deltaTime)
240 255 {
241 256 this.renderer.setSubImage(3);
@@ -24,7 +24,7 @@ class Frog extends GameObject
24 frog_tongue_base = null;
24 frog_tongue_base = null;
25 frog_tongue_tip = null;
25 frog_tongue_tip = null;
26
26
27 floorTileConnections = [];
27 tongue_obj_ref = null;
28
28
29 constructor (x, y, sprite, layer)
29 constructor (x, y, sprite, layer)
30 {
30 {
@@ -80,6 +80,7 @@ class Frog extends GameObject
80 if (!this.tongue_retracted)
80 if (!this.tongue_retracted)
81 {
81 {
82 this.retractTongueLength(deltaTime);
82 this.retractTongueLength(deltaTime);
83 this.updateFruitObjRef();
83 }
84 }
84 else
85 else
85 {
86 {
@@ -115,8 +116,14 @@ class Frog extends GameObject
115
116
116 let obj = Ray.Cast(this.scene, collisionVector, new vector(this.tongueVectorBounce ? this.currentFacing : this.opposite_facing, -1), 5);
117 let obj = Ray.Cast(this.scene, collisionVector, new vector(this.tongueVectorBounce ? this.currentFacing : this.opposite_facing, -1), 5);
117
118
118 obj.collider.enabled = false;
119 if (obj && obj instanceof Fruit)
120 {
121 console.log(obj);
122 obj.collider.enabled = false;
123 this.tongue_obj_ref = obj;
119
124
125 this.retracting = true;
126 }
120
127
121 }
128 }
122
129
@@ -236,6 +243,14 @@ class Frog extends GameObject
236 }
243 }
237 }
244 }
238
245
246 updateFruitObjRef ()
247 {
248 if (this.tongue_obj_ref && (this.tongueVectorBounce || this.tongueVector))
249 {
250 this.tongue_obj_ref.position = this.tongueVectorBounce ? this.tongueVectorBounce : this.tongueVector;
251 }
252 }
253
239 extendTongueLength (deltaTime)
254 extendTongueLength (deltaTime)
240 {
255 {
241 this.renderer.setSubImage(3);
256 this.renderer.setSubImage(3);