Colision detection p5.js
问题 just trying to make a simple pong game in p5.js. I have very recently gotten into JavaScript and can't manage to figure out collision detection between the ball and the bat. I have tried a few ways of doing it but it mostly just stopped my code from running.. etc.. would love any help! Here is my source code: function setup() { createCanvas(750, 750); } var x = 50; var y = 50; var direction = 5; var arrow = 0; var ball; var bat; function draw() { background(220); fill ('white'); ball =