{"action":"created","comment":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments/74107645","id":74107645,"diff_hunk":"@@ -76,13 +76,28 @@ module.exports.Group = function (baseConstructor) {\n    * @return {boolean} True if any touching occurred\n    */\n   array.isTouching = function (target) {\n-    var didTouch = false;\n-    for (var i = 0; i < this.length; i++) {\n-      didTouch = this[i].isTouching(target) || didTouch;\n-      // Note: can't early out because each call needs to update the sprite's\n-      // touching property.\n+    var state = jsInterpreter.getCurrentState();","path":"apps/src/gamelab/GameLabGroup.js","position":9,"original_position":9,"commit_id":"25cd498075dd43624eda6e12b4cc612250ec68df","original_commit_id":"25cd498075dd43624eda6e12b4cc612250ec68df","user":{"login":"davidsbailey","id":8001765,"avatar_url":"https://avatars.githubusercontent.com/u/8001765?v=3","gravatar_id":"","url":"https://api.github.com/users/davidsbailey","html_url":"https://github.com/davidsbailey","followers_url":"https://api.github.com/users/davidsbailey/followers","following_url":"https://api.github.com/users/davidsbailey/following{/other_user}","gists_url":"https://api.github.com/users/davidsbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsbailey/subscriptions","organizations_url":"https://api.github.com/users/davidsbailey/orgs","repos_url":"https://api.github.com/users/davidsbailey/repos","events_url":"https://api.github.com/users/davidsbailey/events{/privacy}","received_events_url":"https://api.github.com/users/davidsbailey/received_events","type":"User","site_admin":false},"body":"Per offline discussion, this method shares duplicate code with _groupCollideGameLab which essentially implement an interpreter-friendly for loop. Ways to deal with this include:\r\n1. extract a \"forEach\" utility method\r\n2. make _groupCollideGameLab more general, so that it can call isTouching rather than only AABBops\r\n\r\nper our discussion it seems fine to wait until this logic is needed a 3rd time, and then consider extracting forEach.","created_at":"2016-08-09T17:43:43Z","updated_at":"2016-08-09T17:43:43Z","html_url":"https://github.com/code-dot-org/code-dot-org/pull/9912#discussion_r74107645","pull_request_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9912","_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments/74107645"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/9912#discussion_r74107645"},"pull_request":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9912"}}},"pull_request":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9912","id":80530642,"html_url":"https://github.com/code-dot-org/code-dot-org/pull/9912","diff_url":"https://github.com/code-dot-org/code-dot-org/pull/9912.diff","patch_url":"https://github.com/code-dot-org/code-dot-org/pull/9912.patch","issue_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/9912","number":9912,"state":"open","locked":false,"title":"Gamelab bug fix: Group collisions should return correct value","user":{"login":"caleybrock","id":4640747,"avatar_url":"https://avatars.githubusercontent.com/u/4640747?v=3","gravatar_id":"","url":"https://api.github.com/users/caleybrock","html_url":"https://github.com/caleybrock","followers_url":"https://api.github.com/users/caleybrock/followers","following_url":"https://api.github.com/users/caleybrock/following{/other_user}","gists_url":"https://api.github.com/users/caleybrock/gists{/gist_id}","starred_url":"https://api.github.com/users/caleybrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caleybrock/subscriptions","organizations_url":"https://api.github.com/users/caleybrock/orgs","repos_url":"https://api.github.com/users/caleybrock/repos","events_url":"https://api.github.com/users/caleybrock/events{/privacy}","received_events_url":"https://api.github.com/users/caleybrock/received_events","type":"User","site_admin":false},"body":"Bugs before this PR retated to group collisions:\r\n- `sprite.collide(group)` - returns wrong value, except for last item in group\r\n- `sprite.isTouching(group)` - returns wrong value, except for last item in group\r\n- `group.collide(sprite`) - works as expected\r\n- `group.isTouching(sprite)` - returns wrong value, except for first item in group\r\n\r\nExample project that had issues: https://studio.code.org/projects/gamelab/N67xREBC_HJjbg7E6B5ypw \r\n\r\nAfter this PR:\r\n- `sprite.collide(group)` - returns true when sprite collides with any member of the group\r\n- `sprite.isTouching(group)` - returns true when sprite is touching any member of group\r\n- `group.collide(sprite`) - returns true when any member of the group collides with sprite\r\n- `group.isTouching(sprite)` - returns true when any member of the group is touching sprite\r\n\r\nIn `group.collide(sprite)`, @cpirich created a substate that allowed the function to get called once for each element of the group so that it would return true when any element of the group collided. I added this logic for `isTouching` methods and in `GameLabSprite`. @islemaster is looking into a refactor for the state logic as a followup.\r\n\r\nAdded a set of tests for group collisions - @islemaster and I paired on this.","created_at":"2016-08-08T22:08:49Z","updated_at":"2016-08-09T17:43:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eaf460fc7a40063830b0730533a5ace25bfdab53","assignee":{"login":"islemaster","id":1615761,"avatar_url":"https://avatars.githubusercontent.com/u/1615761?v=3","gravatar_id":"","url":"https://api.github.com/users/islemaster","html_url":"https://github.com/islemaster","followers_url":"https://api.github.com/users/islemaster/followers","following_url":"https://api.github.com/users/islemaster/following{/other_user}","gists_url":"https://api.github.com/users/islemaster/gists{/gist_id}","starred_url":"https://api.github.com/users/islemaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/islemaster/subscriptions","organizations_url":"https://api.github.com/users/islemaster/orgs","repos_url":"https://api.github.com/users/islemaster/repos","events_url":"https://api.github.com/users/islemaster/events{/privacy}","received_events_url":"https://api.github.com/users/islemaster/received_events","type":"User","site_admin":false},"assignees":[{"login":"islemaster","id":1615761,"avatar_url":"https://avatars.githubusercontent.com/u/1615761?v=3","gravatar_id":"","url":"https://api.github.com/users/islemaster","html_url":"https://github.com/islemaster","followers_url":"https://api.github.com/users/islemaster/followers","following_url":"https://api.github.com/users/islemaster/following{/other_user}","gists_url":"https://api.github.com/users/islemaster/gists{/gist_id}","starred_url":"https://api.github.com/users/islemaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/islemaster/subscriptions","organizations_url":"https://api.github.com/users/islemaster/orgs","repos_url":"https://api.github.com/users/islemaster/repos","events_url":"https://api.github.com/users/islemaster/events{/privacy}","received_events_url":"https://api.github.com/users/islemaster/received_events","type":"User","site_admin":false},{"login":"davidsbailey","id":8001765,"avatar_url":"https://avatars.githubusercontent.com/u/8001765?v=3","gravatar_id":"","url":"https://api.github.com/users/davidsbailey","html_url":"https://github.com/davidsbailey","followers_url":"https://api.github.com/users/davidsbailey/followers","following_url":"https://api.github.com/users/davidsbailey/following{/other_user}","gists_url":"https://api.github.com/users/davidsbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsbailey/subscriptions","organizations_url":"https://api.github.com/users/davidsbailey/orgs","repos_url":"https://api.github.com/users/davidsbailey/repos","events_url":"https://api.github.com/users/davidsbailey/events{/privacy}","received_events_url":"https://api.github.com/users/davidsbailey/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9912/commits","review_comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9912/comments","review_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/9912/comments","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/25cd498075dd43624eda6e12b4cc612250ec68df","head":{"label":"code-dot-org:group-collisions","ref":"group-collisions","sha":"25cd498075dd43624eda6e12b4cc612250ec68df","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","deployments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/deployments","created_at":"2014-09-20T00:46:11Z","updated_at":"2016-08-06T19:45:47Z","pushed_at":"2016-08-09T17:42:57Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":4851508,"stargazers_count":133,"watchers_count":133,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":82,"mirror_url":null,"open_issues_count":43,"forks":82,"open_issues":43,"watchers":133,"default_branch":"staging"}},"base":{"label":"code-dot-org:staging","ref":"staging","sha":"10d00b6735f141ccbf633780e5f396d36aae68c7","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","deployments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/deployments","created_at":"2014-09-20T00:46:11Z","updated_at":"2016-08-06T19:45:47Z","pushed_at":"2016-08-09T17:42:57Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":4851508,"stargazers_count":133,"watchers_count":133,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":82,"mirror_url":null,"open_issues_count":43,"forks":82,"open_issues":43,"watchers":133,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9912"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/9912"},"issue":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/9912"},"comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/9912/comments"},"review_comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9912/comments"},"review_comment":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/9912/commits"},"statuses":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/25cd498075dd43624eda6e12b4cc612250ec68df"}}}}
{"actor":{"display_login":"davidsbailey"}}