I am trying to convert the value of numeric keys into integers, but I don’t know how to proceed with this problem. I have tried many approaches. What am I doing wrong? I don’t have much knowledge related to programming.
circle_x = 250
circle_y = 250
circle_size = 50
diameter = 50
def calculate_size(diameter, key):
return diameter ** key
def setup():
size(500, 500)
return
def draw():
global circle_x, circle_y, circle_size
background(0, 0, 40)
ellipse(circle_x,circle_y, circle_size, circle_size)
def mouseClicked():
global circle_x, circle_y
circle_x = mouseX
circle_y = mouseY
def keyPressed():
global circle_size, circle_x, circle_y, diameter
if key == int(key):
circle_size(circle_x, circle_y, calculate_size(diameter,key), calculate_size(diameter, key))
Preformatted text