本文实例为大家分享了php微信跳一跳的具体代码,供大家参考,具体内容如下

<"#%05d: ", $id); 
 // 截图 
 screencap(); 
 // 获取坐标 
 $image = imagecreatefrompng('screen.png'); 
 list($sx, $sy) = getStart(); 
 list($tx, $ty) = getEnd(); 
 if ($sx == 0) break; 
 echo sprintf("(%d, %d) -> (%d, %d) ", $sx, $sy, $tx, $ty); 
 // 图像描点 
 imagefilledellipse($image, $sy, $sx, 10, 10, 0xFF0000); 
 imagefilledellipse($image, $ty, $tx, 10, 10, 0xFF0000); 
 imagepng($image, sprintf("screen/%05d.png", $id)); 
 // 计算按压时间 
 $time = pow(pow($tx - $sx, 2) + pow($ty - $sy, 2), 0.425) * PRESS_TIME; 
 $time = round($time); 
 echo sprintf("time: %f\n", $time); 
 press($time); 
 // 等待下一次截图 
 sleep(SLEEP_TIME); 
} 

<"htmlcode">
function jump() { 
sleep(2.5);//延迟 2.5 秒,音乐盒、便利店、井盖等站 2 秒加分 
$screenShell = "cd D:\&adb shell /system/bin/screencap -p /sdcard/screenshot.png&adb pull /sdcard/screenshot.png d:jumper/screenshot.png"; 
exec($screenShell);//截图 
 
$i=imagecreatefrompng("d:jumper/screenshot.png");//读取图片 
$point=array(); 
for ($y=400;$y<imagesy($i);$y++) {//从第 400 行开始,避开上部内容 
for ($x=0;$x<imagesx($i);$x++) {//横向扫描 
$rgb = imagecolorat($i,$x,$y);//取得颜色 
$point["now"]["r"] = ($rgb16) & 0xFF; 
$point["now"]["g"] = ($rgb8) & 0xFF; 
$point["now"]["b"] = $rgb & 0xFF; 
if(isset($point["last"]["r"])){ 
if(!isset($point["x"]["a"])){ 
if( abs($point["now"]["r"]-$point["last"]["r"])>1 
or abs($point["now"]["g"]-$point["last"]["g"])>1 
or abs($point["now"]["b"]-$point["last"]["b"])>1 
){ 
$point["x"]["a"]=$x; 
if(imagesx($i)/2>$x){ 
$point["direction"]="left"; 
}else{ 
$point["direction"]="right"; 
} 
$point["a"]=$point["last"]; 
} 
}else{ 
if($point["now"]==$point["a"]){ 
$point["x"]["b"]=$x-1; 
break; 
} 
} 
} 
$point["last"]=$point["now"]; 
} 
if(isset($point["x"])){ 
break; 
} 
} 
 
$param["left"] = 3750; 
$param["right"] = 3100; 
$time = pow((abs(imagesx($i)/2-($point["x"]["a"]+$point["x"]["a"])/2)/imagesx($i)),1)*$param[$point["direction"]]; 
 
if($time<400){ 
$time+=($param[$point["direction"]]/300); 
} 
$time = round($time,0); 
echo "direction:".$point["direction"]; 
echo "\nx.a:".$point["x"]["a"]; 
echo "\nx.b:".$point["x"]["b"]; 
echo "\ntime:".$time."\n"; 
$touchShell = "cd D:\&adb shell input swipe 50 250 250 250 ".$time; 
exec($touchShell); 
imagedestroy($i); 
jump(); 
} 
 
jump(); 

更多内容大家可以参考专题《微信跳一跳》进行学习。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com