Skip to content

Commit

Permalink
shootPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Umbrella167 committed Apr 15, 2024
1 parent 4337732 commit a8a98aa
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Core/tactics/play/newNormalPlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ firstState = "Init",
UpdataTickMessage(our_goalie_num,defend_num1,defend_num2) -- 更新帧信息
local State = getState()
getState()
-- return State
return State
end,
Assister = gSubPlay.roleTask("ShootPoint", "Assister"),
Kicker = task.goCmuRush(runPos("Kicker",true),closures_dir_ball("Kicker"),_,DSS_FLAG),
Expand Down
25 changes: 19 additions & 6 deletions Core/tactics/play/shootPoint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ local shootPosFun = function()
return param.shootPos
end
end
local debugMesg = function ()
debugEngine:gui_debug_msg(CGeoPoint(-1000,1000),shootPosFun():x() .. " " .. shootPosFun():y(),3)
debugEngine:gui_debug_line(player.pos("Assister"),player.pos("Assister") + Utils.Polar2Vector(9999,player.dir("Assister") + param.shootError / 57.3))
debugEngine:gui_debug_line(player.pos("Assister"),player.pos("Assister") + Utils.Polar2Vector(9999,player.dir("Assister") - param.shootError / 57.3))
end

local shoot_kp = param.shootKP

return {

Expand All @@ -34,8 +41,9 @@ firstState = "ready1",

["ready1"] = {
switch = function()
debugEngine:gui_debug_msg(CGeoPoint(-1000,1000),shootPosFun():x() .. " " .. shootPosFun():y(),3)
debugMesg()
shoot_pos = shootPosFun()

if(player.infraredCount("Assister") > 5) then
return "shoot"
end
Expand All @@ -49,23 +57,28 @@ firstState = "ready1",
-- if(not bufcnt(player.infraredOn("Assister"),1)) then
-- return "ready1"
-- end
debugEngine:gui_debug_msg(CGeoPoint(-1000,1000),shootPosFun():x() .. " " .. shootPosFun():y(),3)
if(task.playerDirToPointDirSub("Assister",shootPosFun()) < 8) then
debugMesg()
if shootPosFun():x() == param.pitchLength / 2 then
shoot_kp = 10000
else
shoot_kp = param.shootKP
end
if(task.playerDirToPointDirSub("Assister",shootPosFun()) < param.shootError) then
return "shoot1"
end
end,
Assister = task.TurnToPointV2("Assister", function() return param.shootPos end,param.rotVel),
Assister = function() return task.TurnToPointV2("Assister", function() return param.shootPos end,param.rotVel) end,
match = "{A}"
},

["shoot1"] = {
switch = function()
debugEngine:gui_debug_msg(CGeoPoint(-1000,1000),shootPosFun():x() .. " " .. shootPosFun():y(),3)
debugMesg()
if(not bufcnt(player.infraredOn("Assister"),1)) then
return "ready1"
end
end,
Assister = task.ShootdotV2(function() return param.shootPos end, 10, 8, kick.flat),
Assister = task.ShootdotV2(function() return param.shootPos end, shoot_kp, param.shootError, kick.flat),
match = "{A}"
},

Expand Down
2 changes: 2 additions & 0 deletions ZBin/lua_scripts/worldmodel/param.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ module(..., package.seeall)
powerShoot = 300
powerTouch = 300
shootPos = CGeoPoint(0,0)
shootError = 3
shootKp = 1.2
---------------------------------
-- 旋转参数
rotPos = CGeoPoint(150,120)
Expand Down
4 changes: 2 additions & 2 deletions ZBin/lua_scripts/worldmodel/task.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ function power(p, Kp) --根据目标点与球之间的距离求出合适的 击
if res > 6000 then
res = 6000
end
if res < 3500 then
res = 3500
if res < 2500 then
res = 2500
end
debugEngine:gui_debug_msg(CGeoPoint:new_local(0,3200),"Power" .. res,3)
return res
Expand Down

0 comments on commit a8a98aa

Please sign in to comment.