How can I control rotations for a class?

edited December 2016 in Python Mode

Hey, this may seem like a minor question, but I'm having trouble on stopping rotations for a specific class. Mind you, this is processing 2.x, and I'm using Python.

` def setup(): size(400,400)

global angle
angle = 0

global bangle
bangle = 0

global cangle
cangle = 0

global dangle
dangle = 0

global stars
stars = []
for i in range(10):
    s = star()
    stars.append(s)

def draw(): global angle angle+=PI/72

global bangle
bangle+=PI/8

global cangle
cangle+=PI/36

global dangle
dangle+=PI

background(70)

#THE SUN
translate(200,200)
fill(255,255,0)
ellipse(0,0,50,50)

#MARS
rotate(angle)
fill(175,0,0)
ellipse(160,0,20,20)

#EARTH
rotate(cangle)
fill(0,0,255)
ellipse(100,0,20,20)
translate(100,0)

#MOON
rotate(cangle)
fill(128,128,128)
ellipse(30,20,10,10)
translate(30,20)

#MOON'S MOON
rotate(bangle)
fill(139,0,139)
ellipse(5,10,7,7)

for star in stars:
    star.noRotate()
    star.display()

class star: def init(self): self.xpos = random(width) self.ypos = random(height) self.color = color(255)

def display(self):
    fill(self.color)
    noStroke()
    ellipse(self.xpos,self.ypos,5,5)

def noRotate(self):
    rotate(dangle)`

My issue is the stars are rotating, and I was wondering how I could possibly stop them from doing so. Thank you in advance.

Answers

Sign In or Register to comment.