最近微信跳一跳小游戏很火,本文主要为大家详细介绍了微信跳一跳辅助php代码实现,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能帮助到大家。
本文实例为大家分享了php微信跳一跳的具体代码,供大家参考,具体内容如下
<?php
require 'config.php';
function similar($rgb1, $rgb2) {
$r1 = ($rgb1 >> 16) & 0xFF;
$g1 = ($rgb1 >> 8) & 0xFF;
$b1 = $rgb1 & 0xFF;
$r2 = ($rgb2 >> 16) & 0xFF;
$g2 = ($rgb2 >> 8) & 0xFF;
$b2 = $rgb2 & 0xFF;
return abs($r1 - $r2) 20) {
if (!isset($mid)) $mid = ($l + $r) / 2;
if ($r - $l > BODY_WIDTH * 1.1){
if ($r (%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
", $time);
press($time);
// 等待下一次截图
sleep(SLEEP_TIME);
}
登录后复制
<?php
/**
* 按压力度参数,根据实际表现进行调节
* 如果跳远了就调低点
*/
//define('PRESS_TIME', 3.752);
define('PRESS_TIME', 3.452);
/**
* 睡眠时间
*/
define('SLEEP_TIME', 2);
/**
* 角色宽度,不需要调节
*/
define('BODY_WIDTH', 75);
登录后复制
###################我是分割线######################
另一种方法
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 for>>16) & 0xFF;
$point["now"]["g"] = ($rgb>>8) & 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<p>大家学会了吗?赶紧动手尝试一下吧。</p>
<p><span>立即学习</span>“<a href="https://pan.quark.cn/s/7fc7563c4182" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">PHP免费学习笔记(深入)</a>”;</p>
<p>相关推荐:<br></p>
<p><a href="http://www.php.cn/js-tutorial-384152.html" target="_self">原生js实现html5打砖块小游戏的方法</a></p>
<p><a href="http://www.php.cn/js-tutorial-381972.html" target="_self">html5制作吃月饼小游戏教程</a></p>
<p><a href="http://www.php.cn/js-tutorial-377174.html" target="_self">JavaScript编写的网页小游戏分享(图)</a></p></imagesy>
登录后复制
以上就是php实现微信跳一跳小游戏的详细内容,更多请关注米云其它相关文章!
