Mouse dragged in P5js

Hi @AKAC,

all the good ideas were already in your code snippet!!

One thing that stopped it from working though (I think) is that you defined the mousePressed() / mouseDragged() functions inside your draw() function… all these event listeners should always be defined “outside” (on the same “level” as your setup() and draw() functions). It is only there that these so-called “event-listeners” are actually listening for your mouse and key “events”. :slight_smile:

You can see a very simple example in this p5.js editor sketch. The dragging functionality is very basic but it should get you going! No worries if you get stuck again.