Ghosts (1000 lines)

For this part of the assignment I wanted to use for loops to make a complex, ghastly shape to be placed in a dark background. In some ways I find it successful, but I would like to get the movement a little more “floaty” than it currently is.

 


##Will Taylor
## Ghosts (1000 Liner)
width, height = 800,800
radius = 100
circleXY = [[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))],
[int(random(width)), int(random(height))]]
def setup():
background(255,200)
size(width,height)
frameRate(24)

def draw():
background(0,10)
fill(0,120);
rect(0,0,width,height);
smooth()
strokeWeight(1)
stroke(0)


def checkMatch():
for i in xrange(len(circleXY)):
x = circleXY[i][0]
y = circleXY[i][1]
if (x == mouseX and y == mouseY):
background(0)
return True


def drawCircles():
rad = radius
for i in xrange(0, len(circleXY)):
stroke(2)
fill(255,10)
for x in xrange(len(circleXY) - i):
if x%2 == 0:
ellipse(circleXY[i][0], circleXY[i][1], rad-4*x, rad+4*x)
ellipse(circleXY[i][0], circleXY[i][1], rad+4*(x+1), rad-4*(x+1))
else:
ellipse(circleXY[i][0], circleXY[i][1], rad+4*x, rad-4*x)
ellipse(circleXY[i][0], circleXY[i][1], rad-4*(x+1), rad+4*(x+1))








def updateCircleX():
for i in xrange(len(circleXY)):
if (circleXY[i][0] > mouseX):
circleXY[i][0] -= int(2*(i+1)%4 + (i+1))
elif (circleXY[i][0] < mouseX):
circleXY[i][0] += int(2*(i+2)%4 + (i+1))

def updateCircleY():
vChase = 1
for i in xrange(len(circleXY)):
if (circleXY[i][1] > mouseY):
circleXY[i][1] -= int(2*(i+1) - i)
elif (circleXY[i][1] < mouseY):
circleXY[i][1] += int(2*(i+1) - i)

def updateCircles():
updateCircleX()
updateCircleY()

drawCircles()

updateCircles()
checkMatch()

 

Comments are closed.