I have created the image of a dinosaur in openprocessing.org using multiple lines of code. I want to move the dinosaur around the environment as a whole, but moveMouse fn only lets me use one shape at a time. Any advice?
use the translate function in conjunction with the mouseX/Y vars
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
}
function draw() {
background(100); // Set background
translate(mouseX, mouseY); // translate
circle(0, 0, 20); // draw here
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.