소스 검색

Basketball game: adjustments

customisations
alemart 8 달 전
부모
커밋
f33cfcbd6c

+ 2
- 4
demos/basketball/src/entities/ball.js 파일 보기

11
 import { GameEvent } from '../core/events.js';
11
 import { GameEvent } from '../core/events.js';
12
 
12
 
13
 /** Radius of the ball */
13
 /** Radius of the ball */
14
-const BALL_RADIUS = 0.275;
14
+const BALL_RADIUS = 0.27;
15
 
15
 
16
 /** Minimum distance for scoring 3 points */
16
 /** Minimum distance for scoring 3 points */
17
-const THREE_POINT_THRESHOLD = 5.0;
17
+const THREE_POINT_THRESHOLD = 5.5;
18
 
18
 
19
 /** Shoot angle */
19
 /** Shoot angle */
20
 const SHOOT_ANGLE = Math.PI / 4;
20
 const SHOOT_ANGLE = Math.PI / 4;
270
         else if(trigger.name == 'Trigger_B') {
270
         else if(trigger.name == 'Trigger_B') {
271
             if(this._lastTrigger == 'A')
271
             if(this._lastTrigger == 'A')
272
                 this._lastTrigger = 'B';
272
                 this._lastTrigger = 'B';
273
-            /*else if(this._mesh.physicsImpostor.getLinearVelocity().y > 0)
274
-                this._lastTrigger = 'X';*/
275
         }
273
         }
276
         else if(trigger.name == 'Trigger_C') {
274
         else if(trigger.name == 'Trigger_C') {
277
             if(this._lastTrigger == 'B') {
275
             if(this._lastTrigger == 'B') {

+ 4
- 1
demos/basketball/src/entities/gui/gameover-overlay.js 파일 보기

119
 
119
 
120
             container.isVisible = true;
120
             container.isVisible = true;
121
         }
121
         }
122
-        else if(event.type == 'targetlost')
122
+        else if(event.type == 'paused')
123
             this._dismiss();
123
             this._dismiss();
124
         else if(event.type == 'restarted')
124
         else if(event.type == 'restarted')
125
             this._observedLongDistanceShot = false;
125
             this._observedLongDistanceShot = false;
133
      */
133
      */
134
     _dismiss()
134
     _dismiss()
135
     {
135
     {
136
+        if(!this.control.isVisible)
137
+            return;
138
+
136
         this.control.isVisible = false;
139
         this.control.isVisible = false;
137
         this._broadcast(new GameEvent('gameoverdismissed'));
140
         this._broadcast(new GameEvent('gameoverdismissed'));
138
     }
141
     }

+ 5
- 3
demos/basketball/src/entities/gui/tutorial-overlay.js 파일 보기

120
      */
120
      */
121
     _dismiss()
121
     _dismiss()
122
     {
122
     {
123
+        if(!this.control.isVisible)
124
+            return;
125
+
123
         this.control.isVisible = false;
126
         this.control.isVisible = false;
124
         this._broadcast(new GameEvent('tutorialdismissed'));
127
         this._broadcast(new GameEvent('tutorialdismissed'));
125
     }
128
     }
136
                 this.control.isVisible = true;
139
                 this.control.isVisible = true;
137
                 break;
140
                 break;
138
 
141
 
139
-            case 'targetlost':
142
+            case 'slept':
140
                 this.control.isVisible = false;
143
                 this.control.isVisible = false;
141
                 break;
144
                 break;
142
 
145
 
143
             case 'guiresized':
146
             case 'guiresized':
144
-                if(this.control.isVisible)
145
-                    this._dismiss();
147
+                this.control.markAllAsDirty();
146
                 break;
148
                 break;
147
         }
149
         }
148
     }
150
     }

Loading…
취소
저장