Hello! I’m trying to take a drawing of a cat face i’ve made and put it into custom classes that follow a mouse as it moves. I’m a bit confused as to the differences between the base class and an implemented child class. How does one go putting a fairly complex drawing into classes? I know I need to implement a float x = mouseX; and float y = mouseY; into my shapes as well to make them follow the mouse but i’m very confused. Here is my code so far.
Please, edit your post by clicking the small pen icon on the top right of your post, selecting your code and clicking the </> icon in the editor.
Note that you can also hit ctrl+t in processing to indent everything properly.
You can find all the information here:
Now for your question, you can use the translate function to move your cat around. Here an example:
For your class, it would be pretty simple. If the only thing you want is to draw and follow the mouse you just need to create a class Cat and add a show function inside that is a copy paste of the previous draw() function. Like this: