Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dominos = 200
- def setup():
- size(500,500)
- background(0)
- # fill(255)
- # rect(0,450,450,500)
- def draw():
- global dominos
- viejosabroso(dominos)
- # background(0)
- fill(255)
- rect(0,450,450,500)
- # rect(450,0,500,450)
- fill(128)
- square(dominos, 450, 50)
- # square (X, Y, size)
- #print(mouseX, mouseY)
- #print(dominos)
- if mousePressed:
- if mouseY > 450:
- dominos = mouseX - 25
- if dominos <= 0:
- dominos = 0
- elif dominos >= 400:
- dominos = 400
- #######################################################################
- def viejosabroso(var0):
- newColor = map(var0, 0, 400, 0, 255)
- # print(var0, newColor)
- background(newColor) # 0 - 255
- # generalmente NO queremos dibujar dentro de estos eventos, porque
- # no sabemos en qué momento exactamente el usuario va a mandar a
- # llamar uno
- # def mousePressed():
- # global dominos
- # print("mousePressed() se ejecuto una vez")
- # if mouseY > 450:
- # dominos = mouseX - 25
- # if dominos <= 0:
- # dominos = 0
- # elif dominos >= 400:
- # dominos = 400
- # def mouseDragged():
- # global dominos
- # print("mouseDragged() se ejecuto una vez")
- # if mouseY > 450:
- # dominos = mouseX - 25
- # if dominos <= 0:
- # dominos = 0
- # elif dominos >= 400:
- # dominos = 400
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement