That’s where I am at. I’ve looked everywhere but I couldn’t convert java solutions into my python code
class car():
def __init__(self):
self.c1 = 95
self.c2 = 18
self.c3 = 132
self.width = 1280
self.height = 720
self.x = 100
self.y = self.height / 2
self.speed = 5
self.circleSize = 50
self.UPBUTTON = False
self.DOWNBUTTON = False
self.RIGHTBUTTON = False
self.LEFTBUTTON = False
def CircleDisplay(self):
fill(-196864)
strokeWeight(10.0)
stroke(-16777216)
pushMatrix()
translate(287.5635, 191.73846)
rotate(0.0)
arc(self.x,self.y,247.01285, 247.02548, 0.55413705, 5.770796, PIE)
popMatrix()
fill(-1)
strokeWeight(10.0)
stroke(-16777216)
pushMatrix()
translate(273.42612, 124.58582)
rotate(0.0)
ellipse(self.x,self.y,41.255127, 41.255127)
popMatrix()
fill(-16777216)
strokeWeight(10.0)
stroke(-16777216)
pushMatrix()
translate(278.72766, 125.469406)
rotate(0.0)
ellipse(self.x,self.y,9.0108595, 9.0108595)
popMatrix()
# These functions handles the movement
def keyPressed(self):
if keyPressed == True:
if key == CODED:
if keyCode == UP:
self.y -= self.speed
if key == CODED:
if keyCode == DOWN:
self.y += self.speed
if key == CODED:
if keyCode == RIGHT:
self.x += self.speed
if key == CODED:
if keyCode == LEFT:
self.x -= self.speed
mycar = car()
def setup():
size(mycar.width,mycar.height)
frameRate(120)
def draw():
background(200,154,89)
mycar.CircleDisplay()
mycar.keyPressed()