Skip to content

Commit 58d40fa

Browse files
committed
Cache the vars
1 parent 0b696eb commit 58d40fa

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

src/physics/arcade/Body.js

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -907,23 +907,27 @@ var Body = new Class({
907907
resetFlags: function ()
908908
{
909909
// Store and reset collision flags
910-
this.wasTouching.none = this.touching.none;
911-
this.wasTouching.up = this.touching.up;
912-
this.wasTouching.down = this.touching.down;
913-
this.wasTouching.left = this.touching.left;
914-
this.wasTouching.right = this.touching.right;
915-
916-
this.touching.none = true;
917-
this.touching.up = false;
918-
this.touching.down = false;
919-
this.touching.left = false;
920-
this.touching.right = false;
921-
922-
this.blocked.none = true;
923-
this.blocked.up = false;
924-
this.blocked.down = false;
925-
this.blocked.left = false;
926-
this.blocked.right = false;
910+
var wasTouching = this.wasTouching;
911+
var touching = this.touching;
912+
var blocked = this.blocked;
913+
914+
wasTouching.none = touching.none;
915+
wasTouching.up = touching.up;
916+
wasTouching.down = touching.down;
917+
wasTouching.left = touching.left;
918+
wasTouching.right = touching.right;
919+
920+
touching.none = true;
921+
touching.up = false;
922+
touching.down = false;
923+
touching.left = false;
924+
touching.right = false;
925+
926+
blocked.none = true;
927+
blocked.up = false;
928+
blocked.down = false;
929+
blocked.left = false;
930+
blocked.right = false;
927931

928932
this.overlapR = 0;
929933
this.overlapX = 0;

0 commit comments

Comments
 (0)