Coding Class with Dragging


Recently, somebody gave me a code which permits drag-and-drop an image wherever is possible, of course in works, I rewrote as a class, , but it nor has mistakes, but neither works.

Here is the code

Draggingpic Dragging = new Draggingpic(); void setup() { size(600, 600); noStroke(); Dragging.charge(); } void draw() { background(255); Dragging.mouseDragged(); } class Draggingpic { int x; int y; PImage sample; void Draggingpic(int posx,int posy) { x=posx; y=posy; image(sample, x, y, 50, 30); } void charge() { sample=loadImage("g2.png"); } void mouseDragged() { x=mouseX; y=mouseY; } }



This discussion has been closed.