p5 Button Interaction | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

p5 Button Interaction

Why doesn't the ellipse appear when I click the button? https://code.sololearn.com/WtbZv7193MZF/?ref=app

28th Apr 2019, 11:40 AM
Clueless Coder
Clueless Coder - avatar
4 Answers
+ 8
( ͡⚆ ͜ʖ ͡⚆) Since you are using an object constructor (Ball()), in the add() you have to create an instance of Ball by using the new keyword ex. let ball = new Ball(). There were two other problems I notice 1. random(0.400) should be random(0,400) 2. don't need the draw function in this case https://code.sololearn.com/WTW4Zk013SS2/#html
28th Apr 2019, 1:24 PM
ODLNT
ODLNT - avatar
+ 7
Thanks, I was told using objects is a better choice, is that true? Anyway thanks for the help!
28th Apr 2019, 1:26 PM
Clueless Coder
Clueless Coder - avatar
+ 7
That is true if you want the object to interact with other objects, its environment, or user interaction.
28th Apr 2019, 1:32 PM
ODLNT
ODLNT - avatar
- 1
Good day peeps good to be here
29th Apr 2019, 9:11 AM
Josh