Clicker M6L4
Clicker M6L4
WIDTH = 600
HEIGHT = 400
TITLE = "CLICKER ANIMAL"
FPS = 60
fondo = Actor("background")
animal = Actor("giraffe",(150,250))
count=6000
clic=1
bonus1 =Actor("bonus", (450,100))
bonus2 =Actor("bonus", (450,200))
bonus3 =Actor("bonus", (450,300))
play = Actor("play", (300,100))
crus = Actor("cross", (580, 20))
tienda = Actor("tienda", (300, 200))
coleccion = Actor("coleccion", (300, 300))
precio_1=15
precio_2=200
precio_3=600
mode="menu"
def draw():
if mode =="game":
fondo.draw()
animal.draw()
screen.draw.text(count,pos=(50,30),color = "white",fontsize=96)
bonus1.draw()
screen.draw.text("+1$ cada 2s",pos=(400,70),color = "black",fontsize=20)
screen.draw.text(precio_1,pos=(430,100),color = "black",fontsize=20)
bonus2.draw()
screen.draw.text("+15$ cada 2s",pos=(400,170),color = "black",fontsize=20)
screen.draw.text(precio_2,pos=(430,200),color = "black",fontsize=20)
bonus3.draw()
screen.draw.text("+50$ cada 2s",pos=(400,270),color = "black",fontsize=20)
screen.draw.text(precio_3 ,pos=(430,300),color = "black",fontsize=20)
crus.draw()
elif mode=="menu":
fondo.draw()
play.draw()
screen.draw.text("Dinero:",pos=(20,10),color = "white",fontsize=46)
screen.draw.text(count,pos=(190,10),color = "white",fontsize=46)
tienda.draw()
coleccion.draw()
def bonus_one():
global count
count+=1
def bonus_two():
global count
count+=15
def bonus_three():
global count
count+=50
def on_mouse_down(button,pos):
global count, mode, precio_1, precio_2, precio_3
if button == mouse.left and mode == "game":
if animal.collidepoint(pos):
count += clic
animal.y = 230
animate(animal, tween="linear", duration = 0.5 ,y = 250)
elif bonus1.collidepoint(pos):
if count>=precio_1:
schedule_interval(bonus_one,2)
count-= precio_1
bonus1.y =105
animate(bonus1, tween="linear", duration = 0.5 ,y = 100)
precio_1*=2
elif bonus2.collidepoint(pos):
if count>=precio_2:
schedule_interval(bonus_two,2)
count-= precio_2
bonus2.y =205
animate(bonus2, tween="linear", duration = 0.5 ,y = 200)
precio_2*=2
elif bonus3.collidepoint(pos):
if count>=precio_3:
schedule_interval(bonus_three,2)
count-=precio_3
bonus3.y =305
animate(bonus3, tween="linear", duration = 0.5 ,y = 300)
precio_3*=2
elif crus.collidepoint(pos):
mode = "menu"
elif button == mouse.left and mode == "menu":
if play.collidepoint(pos):
mode = "game"