+ 1

Web instantiate object at touch

I am trying to instantiate particles by touching the screen. I am trying to adapt the code below but no success. Can anyone point me in the right direction? What else do I need? function mousePressed() { boxes[boxes.length] = new Box(mouseX, mouseY, 25, 25); }

5th Jul 2020, 8:02 PM
bell
bell - avatar
2 Answers
+ 1
Mirielle [INACTIVE] I got it! I am so happy, please, find attached the code. I was missing the right event listener and a loop to read in particles on touch. https://code.sololearn.com/WUfP4hA5osiH/?ref=app as you may see, you were acknowledged because I got a lot from your newton conservation of moment code (funny you ansewered my question, you were already credited in the code I posted early on today, movers02). now I can thank you directly!
5th Jul 2020, 11:29 PM
bell
bell - avatar
0
Mirielle [INACTIVE] Thank you! I have done that but still nothing happens. I must be missing something listening to the event? I am reading a long article on touch events but if you have a code where this works, I would be grateful to see an example.
5th Jul 2020, 8:38 PM
bell
bell - avatar