Wait a minute! There are too many functions!
jidou.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pyautogui as pg
import time as ti
import random as rm
grapath="bpic/"
def clicker(x,y):
if x != None and y != None:
pg.click(x,y,button="left",duration=0.5)
else:
print("nooo")
def clicktimerand():
time=rm.randint(1,5)
return time
def syutuxy():
x,y=pg.locateCenterOnScreen(grapath+"syutu.png ")
return x,y
def syuturand(x,y):
rx=rm.randint(-39,21)
ry=rm.randint(-39,26)
x=x+rx
y=y+ry
return x,y
def hokyuxy():
x,y=pg.locateCenterOnScreen(grapath+"hokyu.png ")
return x,y
def hokyurand(x,y):
rx=rm.randint(-27,27)
ry=rm.randint(-30,30)
x=x+rx
y=y+ry
return x,y
def honxy():
x,y=pg.locateCenterOnScreen(grapath+"hon.png ")
return x,y
def honrand(x,y):
rx=rm.randint(-7,7)
ry=rm.randint(-8,8)
x=x+rx
y=y+ry
return x,y
def endxy():
x,y=pg.locateCenterOnScreen(grapath+"end.png ")
return x,y
def endrand(x,y):
rx=rm.randint(-7,7)
ry=rm.randint(-8,8)
x=x+rx
y=y+ry
return x,y
###StartUp#################################
ti.sleep(1)
pg.FAILSAFE=True #move to left over
###Schedule#################################
syutub=syutuxy()
hokyux,hokyuy=hokyuxy()
hokyurx,hokyury=hokyurand(hokyux,hokyuy)
clicker(hokyurx,hokyury)
ti.sleep(2) #loading = Black out
honx,hony=honxy()
honrx,honry=honrand(honx,hony)
ti.sleep(clicktimerand())
clicker(honrx,honry)
print("Di endou")
Hoge: alien:
For the time being, if I made a function to generate the center coordinates of each button and their random coordinates, it would be like this ...
The names of variables are getting complicated because I'm making it with momentum ...
・ This time's catching point
I was looking for an image too early and I was looking for it during loding → Good night with sleep
When I come back, it seems that syutu can not be recognized because it is slightly filtered
·Outlook
Reduce variables → reduce function arguments
Random click length
If you do not write the flowchart properly and schedule it, it will be messed up
Don't look for all the images, take one place on the initial screen and use relative coordinates from there ... Gonyo Gonyo
Recommended Posts