import java.applet.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; public class levitatedTentacle7 extends BApplet { // Set the font and its size (in units of pixels) int xWidth = 600, yHeight = 600; int total = 0; Tentacle[] tentacle = new Tentacle[1000]; boolean clear = true; boolean click = false; int counter = 0; void setup() { for (int i=0; i= 500){ total = 500; } else { if (counter > 1){ counter = 0; total = total + 1; } } } void drawState(){ if (clear){ fill(0); noStroke(); rect(0,0,width,height); } } void keyReleased () { if (key == ' ' && clear) { clear = false; } else if (key == ' ' && !clear) { clear = true; } } class Tentacle { int numNodes = 10; float head = 3; float girth = 3; float speedCoefficient = random(0.2f,0.4f); float friction = random(0.6f,0.9f); float muscleRange = 45; float muscleFreq = random(0.1f,0.3f); float theta; float thetaMuscle; float count = 0; float xPos, yPos; float tv; float angle; float xOffset = width/2; float yOffset = height/2; SnakeHead[] node = new SnakeHead[numNodes]; Tentacle () { } void move () { if(count == 0){ xPos = mouseX; yPos = mouseY; for (int n=0; n 0){ node[n].setX(((pmouseX - mouseX)*(n/20)) + mouseX); node[n].setY(((pmouseY - mouseY)*(n/20)) + mouseY); } else { node[n].setX(mouseX); node[n].setY(mouseY); } } angle = atan2((mouseY-pmouseY), (mouseX-pmouseX)); theta = angle * (180/PI); } tv = tv + random(-10,10); theta = theta + tv; tv = tv * friction; if (node[0].getX() > 600){ xPos = xPos - 600; for (int n=0; n 600){ yPos = yPos - 600; for (int n=0; n500) || (yPos<100) || (yPos>500)){ // destroy(); //} } } for (int i=2; i