We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey I tried to make a worm that stretches and moves across the canvas. But so far I can only make it moving in the same location although I tried to increment the positionX. Could someone help me find out what is going wrong.
var offset = 150;
var angle1 = 300;
var scalar = 40;
var speed1 = 0.2;
var speed2 = 0.2;
function setup() {
createCanvas(1000,600);
}
function draw() {
background(255);
fill(0);
for(var i=0; i< 30 ;i ++){
push();
var y1= offset - sin(angle1) *scalar;
x1 = 20+i*5;
ellipse(x1,y1,10,10);
angle1 += speed1;
x1 += speed2;
}
}
Answers
Line 18 before the for loop
Line 22 and 23 adter line 24?