File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,28 +178,33 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
178178 {
179179 this . key = key . key ;
180180 this . setTexture ( key ) ;
181+ return ;
181182 }
182183 else if ( key instanceof Phaser . BitmapData )
183184 {
184185 this . key = key . key ;
185186 this . setTexture ( key . texture ) ;
187+ return ;
186188 }
187189 else if ( key instanceof PIXI . Texture )
188190 {
189191 this . key = key ;
190192 this . setTexture ( key ) ;
193+ return ;
191194 }
192195 else
193196 {
194197 if ( key === null || typeof key === 'undefined' )
195198 {
196199 this . key = '__default' ;
197200 this . setTexture ( PIXI . TextureCache [ this . key ] ) ;
201+ return ;
198202 }
199203 else if ( typeof key === 'string' && ! this . game . cache . checkImageKey ( key ) )
200204 {
201205 this . key = '__missing' ;
202206 this . setTexture ( PIXI . TextureCache [ this . key ] ) ;
207+ return ;
203208 }
204209
205210 if ( this . game . cache . isSpriteSheet ( key ) )
@@ -213,18 +218,21 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
213218 this . _frame = 0 ;
214219 this . _frameName = frame ;
215220 this . setTexture ( PIXI . TextureCache [ frameData . getFrameByName ( frame ) . uuid ] ) ;
221+ return ;
216222 }
217223 else
218224 {
219225 this . _frame = frame ;
220226 this . _frameName = '' ;
221227 this . setTexture ( PIXI . TextureCache [ frameData . getFrame ( frame ) . uuid ] ) ;
228+ return ;
222229 }
223230 }
224231 else
225232 {
226233 this . key = key ;
227234 this . setTexture ( PIXI . TextureCache [ key ] ) ;
235+ return ;
228236 }
229237 }
230238
Original file line number Diff line number Diff line change @@ -323,28 +323,33 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
323323 {
324324 this . key = key . key ;
325325 this . setTexture ( key ) ;
326+ return ;
326327 }
327328 else if ( key instanceof Phaser . BitmapData )
328329 {
329330 this . key = key . key ;
330331 this . setTexture ( key . texture ) ;
332+ return ;
331333 }
332334 else if ( key instanceof PIXI . Texture )
333335 {
334336 this . key = key ;
335337 this . setTexture ( key ) ;
338+ return ;
336339 }
337340 else
338341 {
339342 if ( key === null || typeof key === 'undefined' )
340343 {
341344 this . key = '__default' ;
342345 this . setTexture ( PIXI . TextureCache [ this . key ] ) ;
346+ return ;
343347 }
344348 else if ( typeof key === 'string' && ! this . game . cache . checkImageKey ( key ) )
345349 {
346350 this . key = '__missing' ;
347351 this . setTexture ( PIXI . TextureCache [ this . key ] ) ;
352+ return ;
348353 }
349354
350355 if ( this . game . cache . isSpriteSheet ( key ) )
@@ -367,6 +372,7 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
367372 {
368373 this . key = key ;
369374 this . setTexture ( PIXI . TextureCache [ key ] ) ;
375+ return ;
370376 }
371377 }
372378
Original file line number Diff line number Diff line change @@ -336,7 +336,18 @@ Phaser.Math = {
336336 * @return {number }
337337 */
338338 angleBetween : function ( x1 , y1 , x2 , y2 ) {
339- return Math . atan2 ( y2 - y1 , x2 - x1 ) ;
339+ return Math . atan2 ( x2 - x1 , y2 - y1 ) ;
340+ } ,
341+
342+ /**
343+ * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).
344+ * @method Phaser.Math#angleBetweenPoints
345+ * @param {Phaser.Point } point1
346+ * @param {Phaser.Point } point2
347+ * @return {number }
348+ */
349+ angleBetweenPoints : function ( point1 , point2 ) {
350+ return Math . atan2 ( point2 . x - point1 . x , point2 . y - point1 . y ) ;
340351 } ,
341352
342353 /**
You can’t perform that action at this time.
0 commit comments