{"action":"closed","issue":{"url":"https://api.github.com/repos/Montana-Media-Arts/120_CreativeCoding/issues/183","repository_url":"https://api.github.com/repos/Montana-Media-Arts/120_CreativeCoding","labels_url":"https://api.github.com/repos/Montana-Media-Arts/120_CreativeCoding/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/Montana-Media-Arts/120_CreativeCoding/issues/183/comments","events_url":"https://api.github.com/repos/Montana-Media-Arts/120_CreativeCoding/issues/183/events","html_url":"https://github.com/Montana-Media-Arts/120_CreativeCoding/issues/183","id":380935583,"node_id":"MDU6SXNzdWUzODA5MzU1ODM=","number":183,"title":"Not showing and need help with mousePressed","user":{"login":"Dani-Briggs","id":42754006,"node_id":"MDQ6VXNlcjQyNzU0MDA2","avatar_url":"https://avatars2.githubusercontent.com/u/42754006?v=4","gravatar_id":"","url":"https://api.github.com/users/Dani-Briggs","html_url":"https://github.com/Dani-Briggs","followers_url":"https://api.github.com/users/Dani-Briggs/followers","following_url":"https://api.github.com/users/Dani-Briggs/following{/other_user}","gists_url":"https://api.github.com/users/Dani-Briggs/gists{/gist_id}","starred_url":"https://api.github.com/users/Dani-Briggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dani-Briggs/subscriptions","organizations_url":"https://api.github.com/users/Dani-Briggs/orgs","repos_url":"https://api.github.com/users/Dani-Briggs/repos","events_url":"https://api.github.com/users/Dani-Briggs/events{/privacy}","received_events_url":"https://api.github.com/users/Dani-Briggs/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-11-14T23:39:37Z","updated_at":"2018-11-16T17:00:58Z","closed_at":"2018-11-16T17:00:58Z","author_association":"NONE","body":"hi again,\r\nI'm on hw-12 and my sketch is not showing up again. I also need some help with the some functions. What I want to do is to have two balls on different sides of the screen, that are two different colors, and when someone clicks and holds on the screen, the two balls will move towards the cursor and change to the same color. What I need help on is how to set up the function for the balls to move to the cursor and to change color.\r\nHere's the code.\r\n`//setting up the varables\r\n\r\nlet balls = [];\r\nlet num_of_balls = 2;\r\n\r\n//setup\r\nfunction setup(){\r\n    createCanvas(windowWidth, 600);\r\n\r\n    let init_x = 60;\r\n    let init_y = 60;\r\n    for (let i = 0; i < num_of_balls; i++){\r\n      balls.push(new Ball(init_x, init_y));\r\n\r\n      init_x += 100;\r\n      if (init_x > width){\r\n        init_x = 60;\r\n        init_y += 100;\r\n      }\r\n    }\r\n\r\n\r\n}\r\n\r\n\r\n//draw\r\nfunction draw(){\r\n  background('rgb(166, 32, 66)');\r\n\r\n  for (let i = 0; i < balls.length; i++){\r\n    balls[i].ballCheck(balls, i);\r\n    balls[i].wallCheck();\r\n    balls[i].move();\r\n    balls[i].display();\r\n  }\r\n\r\n\r\n}\r\n\r\n\r\n\r\n///////\r\n// creating the class\r\n//////\r\n\r\nclass Ball {\r\n  constructor(){\r\n    this.color_one = 'blue';\r\n    this.color_two = 'yellow';\r\n    this.size = (20, 50);\r\n    this.rad = this.size / 2;\r\n    this.posX = x;\r\n    this.posY = y / 2;\r\n    this.deltaX = random(-5,5);\r\n    this.deltaY = random(-5,5);\r\n  }\r\n\r\n  display(){\r\n    push();\r\n\r\n    stroke(0);\r\n    strokeWeight(5);\r\n    fill(this.color_one);\r\n    translate(this.posX, this.posY);\r\n    ellispe(0, 0, this.size);\r\n\r\n    pop();\r\n\r\n    push();\r\n\r\n    stroke(0);\r\n    strokeWeight(5);\r\n    fill(this.color_two);\r\n    translate((this.posX * -1), (this.posY * -1));\r\n    ellispe(0, 0, this.size);\r\n\r\n    pop();\r\n\r\n  }\r\n\r\n  move(){\r\n    this.fri_posY += this.deltaY\r\n    this.sec_posY += this.deltaY\r\n  }\r\n\r\n  wallCheck(otherBall, myVar){\r\n      for (let n = 0; n < otherBall.length; n++){\r\n        if (n != myVar){\r\n          let d = dis(this.posX, this.posY, otherBall[n].posX, otherBall[n].posY);\r\n          let combR = this.rad + otherBall[n].rad;\r\n\r\n          if (d <= combR){\r\n            this.deltaX *= -1;\r\n            this.deltaY *= -1;\r\n\r\n          }\r\n        }\r\n      }\r\n\r\n  }\r\n  mouseCheck(){\r\n\r\n    let d = dist(this.posX, (this.posY*2), mouseX, mouseY);\r\n    if (d > this.rad) {\r\n      return true;\r\n    }else {\r\n        return false;\r\n      }\r\n    }\r\n  \r\n}` "}}
{"actor":{"display_login":"Dani-Briggs"}}