Skip to content
Browse files

defolderize

  • Loading branch information...
1 parent 631748b commit 0b7f1ce7e0d4e7003b2c9d2fe25ebffdece88504 @jdf committed Sep 9, 2010
View
0 ...ancedData/DirectoryList/directory_list.py → ....py/Topics/AdvancedData/directory_list.py
File renamed without changes.
View
32 ...Topics/AdvancedData/Lists/list_example.py → ...es.py/Topics/AdvancedData/list_example.py
@@ -1,8 +1,8 @@
"""
* List of objects
- * based on ArrayListClass Daniel Shiffman.
- *
- * This example demonstrates how to use a Python list to store
+ * based on ArrayListClass Daniel Shiffman.
+ *
+ * This example demonstrates how to use a Python list to store
* a variable number of objects. Items can be added and removed
* from the list.
*
@@ -14,39 +14,38 @@
# Simple bouncing ball class
-class Ball:
- def __init__(self, tempX, tempY, tempW):
+class Ball:
+ def __init__(self, tempX, tempY, tempW):
self.x = tempX
self.y = tempY
self.w = tempW
self.speed = 0
self.gravity = 0.1
self.life = 255
-
- def move(self):
+
+ def move(self):
# Add gravity to speed
self.speed = self.speed + self.gravity
# Add speed to y location
self.y = self.y + self.speed
# If square reaches the bottom
# Reverse speed
- if (self.y > height):
+ if self.y > height:
# Dampening
self.speed = self.speed * -0.8
self.y = height
-
+
self.life -= 1
-
+
def finished(self):
# Balls fade out
return self.life < 0
-
- def display(self):
+
+ def display(self):
# Display the circle
fill(0, self.life)
#stroke(0,life)
ellipse(self.x, self.y, self.w, self.w)
-
def setup():
size(200, 200)
@@ -56,7 +55,6 @@ def setup():
# Start by adding one element
balls.append(Ball(width / 2, 0, ballWidth))
-
def draw():
background(255)
@@ -66,9 +64,7 @@ def draw():
ball.display()
if ball.finished():
balls.remove(ball)
-
-def mousePressed():
+
+def mousePressed():
# A new ball object is added to the list (by default to the end)
balls.append(Ball(mouseX, mouseY, ballWidth))
-
-
View
0 ...es.py/Topics/Effects/Metaball/Metaball.py → examples.py/Topics/Effects/Metaball.py
File renamed without changes.
View
0 ...Processing/EdgeDetection/EdgeDetection.py → .../Topics/Image Processing/EdgeDetection.py
File renamed without changes.
View
0 ...e Processing/EdgeDetection/data/house.jpg → ...py/Topics/Image Processing/data/house.jpg
File renamed without changes

0 comments on commit 0b7f1ce

Please sign in to comment.
Something went wrong with that request. Please try again.